[ntp:questions] Local clock question with dialup connection

Steve Kostecke kostecke at ntp.isc.org
Tue Apr 24 01:37:00 UTC 2007


On 2007-04-23, Nigel Henry <cave.dnb at tiscali.fr> wrote:
> On Monday 23 April 2007 22:20, Steve Kostecke wrote:
>
>> #!/bin/sh
>>
>> # The hostname or IP address of the host that you want to ping.
>> TARGET=
>>
>> while [ 1 ]

Start an infinite loop consisting of the statements between the 'do' and
'done'.

>> do
>>   /bin/ping -c 4 $TARGET 2>/dev/null >/dev/null && break

&& is a command operator which denotes an AND list. An AND list has the
form:

	command1 && command2

command2 is executed if, and only if, command1 returns an exit status of
zero. 'man bash' for more information.

So, in the line quoted above ...

Ping the $TARGET 4 times throwing away all output. Break out of the loop
if the ping is successful. Otherwise continue to the next step.

>>   /bin/sleep 60
>>
>> done
>>
>> /usr/local/bin/ntp-restart

The ntp-restart line is the only thing left to execute after breaking
out of the loop.

-- 
Steve Kostecke <kostecke at ntp.isc.org>
NTP Public Services Project - http://ntp.isc.org/




More information about the questions mailing list