[ntp:questions] Re: ntp? return value for use in scripts
maarten at kittensandcats.net
Mon Jan 26 22:51:41 UTC 2004
"David Wuertele" <dave-gnus at bfnet.com> wrote in message
news:m3u12i5p5d.fsf at bfnet.com...
> I want to write a script that does the following:
> if [ $? -eq 0 ]
> # sys time is apparently synchronized; so use it to set the
> # non-volatile clock
> /sbin/hwclock --systohc
> # sys time is NOT synchronized (maybe the network is down), so
> # use the non-volatile clock to set the sys time
> /sbin/hwclock --hctosys
> Is there a command I can run that returns an explicit value based on
> whether my system time is being sync'd to Internet NTP services?
I think grepping for a '*' at the start of a line would work.
However, I have my doubts as to the desirability of such a scheme,
not so much the individual steps as their being grouped together.
It seems to me that the first can safely be left to ntpd itself
(but be sure to use a version that does it; not all do), and the
second is done at bootup anyway and need not be repeated afterwards.
More information about the questions