You are not logged in.

#1 2011-03-31 07:52:30

I'mGeorge
Member
Registered: 2011-03-23
Posts: 150

[SOLVED] problem in making a daemon for network auto-connection

I want to make a daemon that when I start my computer and my router is not already available, to auto connect to my router when it becomes available later without rebooting

So I thought in making a script and running it as a daemon which will hopefully solve my problems. The thing is I'm having a hard time isolating only the routers ip address. Here's how I thought the script should look like

#!/bin/sh
anet="$(ifconfig | awk "/router_address/{print $field}")"
if [ $anet = "router_address" ]
then
/etc/rc.d/network restart
fi

   

But although awk isolates the line with my router address it doesn't recognizes any field. Any value I assume to $field doesn't isolates anything so I could guess the right field (or fields) for the router's ip address.

Last edited by I'mGeorge (2011-03-31 09:46:05)


I've first installed Arch in March

Offline

#2 2011-03-31 07:58:48

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [SOLVED] problem in making a daemon for network auto-connection

Not a direct answer to your question, but have you considered using Netcfg for this? https://wiki.archlinux.org/index.php/Netcfg


ᶘ ᵒᴥᵒᶅ

Offline

#3 2011-03-31 08:51:48

I'mGeorge
Member
Registered: 2011-03-23
Posts: 150

Re: [SOLVED] problem in making a daemon for network auto-connection

litemotiv wrote:

Not a direct answer to your question, but have you considered using Netcfg for this? https://wiki.archlinux.org/index.php/Netcfg

thx a bunch, all I needed was ifplugd daemon. That script I thought about was a bad idea anyway 'cause continuous starting or restarting your network can't be good so I had to work more on it while ifplugd made everything happen clean and easily.


I've first installed Arch in March

Offline

#4 2011-03-31 09:29:52

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [SOLVED] problem in making a daemon for network auto-connection

Good to hear I'mGeorge, please mark your thread solved by prepending it to the topic title. smile


ᶘ ᵒᴥᵒᶅ

Offline

Board footer

Powered by FluxBB