How to run script (sleep360) without delaying bootup
sos at zjod.net
Sun Apr 22 17:16:46 UTC 2007
Nigel Henry wrote:
> On Sunday 22 April 2007 18:19, Scott Berry wrote:
> > Nigel, what would you want to ping? I think you could put a line in that
> > script to do that.
> > Scott
> Pinging a server on the Internet isn't really the problem, as long as nobody
> get's T'd off on getting a ping on a daily basis. All I want is a script that
> will continually send a ping to <some server>, then when the Internet
> connection is up, and it gets a positive response from the server, will then
> run /usr/local/bin/ntp-restart, and terminate the ping. This will then
> restart the ntp daemon, and all of the servers listed in /etc/ntp.conf will
> be polled.
> At the moment when the ntp daemon is started at bootup on FC2, I get varying
> results. Post bootup I connect to the Internet, and sometimes just one of the
> six timeservers is listed when running ntpq> pe, and sometimes 4 of the
> timeservers are listed, but never the 6. If I do an /etc/init.d/ntpd stop,
> followed by an /etc/init.d start, then run ntpq, I see all 6 Internet
> timeservers listed.
> There is a problem with the ntp daemon, at least on FC2, when no Internet
> connection is available at bootup.
You can probably do this without pinging.
Assuming you talk to the outside internet via eth0, then "ifconfig eth0"
won't tell you what your ip-address is until eth0 is all the way up.
Thus, the following script will either:
- print your ip-address and return 0 (success),
- print "eth0 not active." and return 1 (failure).
> if [ `/sbin/ifconfig | grep ^$DEVICE | wc -l` = 0 ]
> then echo "$DEVICE not active."
> exit 1
> else mungeline=`/sbin/ifconfig $DEVICE | grep "inet addr" | tr -s ":" " " | cut -d' ' -f4`
> echo $mungeline
> exit 0
Hope this helps,
More information about the users