Re: Local clock question with dialup connection
- From: Steve Kostecke <kostecke@xxxxxxxxxxx>
- Date: 23 Apr 2007 20:20:31 GMT
On 2007-04-23, Nigel Henry <cave.dnb@xxxxxxxxxx> wrote:
The script needs to ping some server on the Internet. If it receives no
response, and exits with a code 1, it will then sleep for 60 secs, then run
the ping again, and so on. When an Internet connection is eventually
established, and that is if I understand this correctly, ping will then exit
with a code 0.
Once a code 0 is received, showing the host to be alive, no further pings
should be sent, and the script at /usr/local/bin/ntp-restart will be run.
Here's one way to do this. Handling situations such as when this script
does not exit or more than one copy of this script is started are left
as an excercise...
#!/bin/sh
# The hostname or IP address of the host that you want to ping.
TARGET=
while [ 1 ]
do
/bin/ping -c 4 $TARGET 2>/dev/null >/dev/null && break
/bin/sleep 60
done
/usr/local/bin/ntp-restart
--
Steve Kostecke <kostecke@xxxxxxxxxxx>
NTP Public Services Project - http://ntp.isc.org/
.
- Follow-Ups:
- Re: Local clock question with dialup connection
- From: Nigel Henry
- Re: Local clock question with dialup connection
- References:
- Local clock question with dialup connection
- From: Nigel Henry
- Re: Local clock question with dialup connection
- From: Nigel Henry
- Re: Local clock question with dialup connection
- From: Harlan Stenn
- Re: Local clock question with dialup connection
- From: Nigel Henry
- Local clock question with dialup connection
- Prev by Date: Secure NTP Server
- Next by Date: Re: Secure NTP Server
- Previous by thread: Re: Local clock question with dialup connection
- Next by thread: Re: Local clock question with dialup connection
- Index(es):
Relevant Pages
|