Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 112391 - bringing up NTP using ifplugd
Summary: bringing up NTP using ifplugd
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-13 02:35 UTC by John (EBo) David
Modified: 2005-11-13 08:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John (EBo) David 2005-11-13 02:35:56 UTC
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
Comment 1 SpanKY gentoo-dev 2005-11-13 03:20:06 UTC
the same could be set for just about any network service, i dont see why you're
making ntp a special case
Comment 2 John (EBo) David 2005-11-13 06:19:22 UTC
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? 
 
 
  
Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-11-13 08:42:58 UTC
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