Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
running commands after aquiring a network ip address
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
KevinU
n00b
n00b


Joined: 23 Jan 2008
Posts: 8

PostPosted: Wed Feb 27, 2008 7:55 am    Post subject: running commands after aquiring a network ip address Reply with quote

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
View user's profile Send private message
Zepp
Veteran
Veteran


Joined: 15 Mar 2004
Posts: 1246
Location: Ontario, Canada

PostPosted: Wed Feb 27, 2008 9:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
KevinU
n00b
n00b


Joined: 23 Jan 2008
Posts: 8

PostPosted: Fri Feb 29, 2008 6:27 am    Post subject: Reply with quote

/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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum