Re: How to run script (sleep360) without delaying bootup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 22 April 2007 22:14, Kam Leo wrote:
> On 4/22/07, Nigel Henry <cave.dnb@xxxxxxxxxx> wrote:
> > On Sunday 22 April 2007 19:16, Steve Siegfried wrote:
> > > 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.
> > > >
> > > > Nigel.
> > >
> > > 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),
> > > or
> > >  - print "eth0 not active." and return 1 (failure).
> > >
> > >     > #!/bin/ksh
> > >     > DEVICE=${1:-eth0}
> > >     > 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
> > >     > fi
> > >
> > > Hope this helps,
> > >
> > > -S
> >
> > This is my setup. I have 2 machines on a LAN. These access the Internet
> > through a Smoothwall firewall, which is installed on an old machine. The
> > Smoothwall accesses the Internet through a serial modem. To connect to
> > Internet I have to have one of the machines on the LAN booted up, so as
> > access the web interface to the Smoothwall.
> >
> > So this is the way it goes. The Smoothwall is left running continually,
> > but I shut down the dialup connection, and the 2 machines on the LAN last
> > thing at night, unless I'm doing updates.
> >
> > Next day. Smoothwall is still running, but no connection to the Internet.
> > Next I boot the machine on the LAN that has the Internet timeservers
> > listed in /etc/ntp.conf. The machine boots up (this is FC2) , but because
> > no Internet connection is available the ntpd times out, goes out to
> > lunch, gives up trying to contact the timeservers, whatever. Post boot
> > up, and running ntpq> pe, sometimes there is 1 of the 6 timeservers
> > showing, and sometimes 4 of the 6.
> >
> > If I now stop and start ntpd all 6 of the timeservers are listed when
> > running ntpq> pe.
> >
> > So, and this is a problem with ntpd on FC2. On FC6 ncpd seems to handle
> > an ititial "no Internet connection available" ok, and when I make the
> > connection to the Internet all the timeservers are listed on ntpq> pe.
> > Back to the FC2 problem.
> >
> > Smoothwall is running, but dialup connection is down. Boot up the machine
> > on the LAN that has the Internet timeservers in /etc/ntp.conf. Ntpd is
> > started on bootup, but can't find the timeservers, as there is no
> > Internet connection, so ntpd decides to go out to lunch.
> >
> > The sort of script that I'm looking for is one that will be either run
> > from /etc/rc.d/rc.local, but without delaying, hanging, stalling the
> > bootup sequence, or being run post bootup as root. A cron job won't do
> > this, as it runs at a specific time. This script needs to be run either
> > during, or post bootup.
> >
> > So this is the script I need. Either started with /etc/init.d/rc.local.
> > or post boot up
> >
> > Ping an Internet address every minute. When a response is received
> > showing an active Internet connection, then run
> > /usr/local/bin/ntp-restart.
> >
> > Perhaps I'm asking too much.
> >
> > Nigel.
>
> Why the obsession with ntp? The on board clock should be able maintain
> accurate time for at least a day or two.

I'm trying to solve a problem here, not trying to start a rant on whether to 
use ntp or not.

This machine has problems with the time, so I'm trying to resolve it. That's 
not much to ask, is it?

Nigel.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux