I had a situation with starting up ntpd and ntp-client when I converted to ifplugd. The problem is that ntp cannot be properly initialized until the network is up, but most configurations start ntp during boot. I would like to submit the following changes to /usr/bin/ifplugd.actions which start/stops the relevant ntp services whenever the network devices come up. if [ -x /etc/init.d/net.$1 ] then /etc/init.d/net.$1 --quiet $state + # allow a little time for the network to come up/down + sleep 5 + + # The NTP client (and likely daemon) cannot run until + # the network is accessible + if [ -x /etc/init.d/ntp-client ] + then + /etc/init.d/ntp-client $state + fi + if [ -x /etc/init.d/ntpd ] + then + /etc/init.d/ntpd $state + fi exit 0 else logger -t ifplugd.action "Error: Couldn't configure $1, no /etc/init.d/net.$1 script!" exit 1 fi There are some issues here where ntpd/ntp-client may be run multipul times when a machine has more than one network devices. If this is an issue we could add an NTP_INTERFACE to /etc/conf.d/ifplugd and specifically check for it above similar to: if [ $NTP_INTERFACE = $1 ] ... fi
the same could be set for just about any network service, i dont see why you're making ntp a special case
fair enough... It was just the first one that shot me in the foot! So, the question should probably be -- how is the best way to solve this problem. As you rightly point out this can be a problem with any network service. One possible solution could be to set up networking services similar to env and rc. This would allow some generic "network service controller" to manage them as they go up or down. "network-update add net.eth0 default" anyone? The real issue is upgradability. If these have to be hacked into the run scripts to get working reasonably well, they just get blown away when the next release of ifplugd comes out... How about moving ifplugd.action somewhere appropriate in /etc and adding it to the files checked by etc-update?
ifplugd-0.28-r4 has moved it's action file back into /etc where it belongs :) You can always put this in /etc/conf.d/net to start any services in the default runlevel that have stopped postup() { /sbin/rc } Or you can set RC_STRICT_NET_CHECKING="lo" in /etc/conf.d/rc which means that net.lo provides "net" so services like ntp can start without a real interface being active