View previous topic :: View next topic |
Author |
Message |
KevinU n00b
Joined: 23 Jan 2008 Posts: 8
|
Posted: Wed Feb 27, 2008 7:55 am Post subject: running commands after aquiring a network ip address |
|
|
I want to run 'iwpriv ath0 bgscan 0' after ath0 is brought up by '/etc/init.d/net.ath0 start' and ntp-client after a network connection is established with either '/etc/init.d/net.ath0 start' or '/etc/init.d/net.eth0 start' (in contrast to when the hardware is started, but not necessarily connected).
How should I set this up? I tried using a postup() function in '/etc/conf.d/net' and 'after net' in the /etc/init.d/net.ath0, but the first doesn't work and the latter checks hardware and not software. |
|
Back to top |
|
|
Zepp Veteran
Joined: 15 Mar 2004 Posts: 1246 Location: Ontario, Canada
|
Posted: Wed Feb 27, 2008 9:26 pm Post subject: |
|
|
You could write another init script that depends on the network being up, or possibly modify one or more of the existing ones so that it runs those commands after bring up the interface? Or you could run the commands in local.start and just put a check in to make sure the network is up. |
|
Back to top |
|
|
KevinU n00b
Joined: 23 Jan 2008 Posts: 8
|
Posted: Fri Feb 29, 2008 6:27 am Post subject: |
|
|
/etc/conf.d/net
postup() {
local iface="$1" IFVAR=$(base_variable "$1") x
if [[ ${iface} == "ath0" ]] ; then
iwlist ath0 bgscan 0
fi
}
/etc/init.d/ntpd and /etc/init.d/ntp-client are both smart enough to wait for network connection on their own now |
|
Back to top |
|
|
|