ntp inquiry

Christopher Browne cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri Jun 3 12:13:55 UTC 2005


On 6/3/05, JM <jerome-mhXWc29+iYPyG1zEObXtfA at public.gmane.org> wrote:
> hi all,
> 
> 	i have a ntp server that syncs with singapore and in the philippines.. just
> 
> recently i have a cron job the that executes twice... im wondering if
> syncing 
> on 2 diff countries is a bad idea.. how does ntp poll for time?

If you are doing this via a cron job, then I presume that what you
have is thus (or otherwise equivalent):

for server in something.sg something.ph; do
   ntpdate $server
done

If you do something like that, with 2 runs of ntpdate, then YOU are
the one polling, and you are doing so twice.  You adjust the time
first to the "Singapore" time, then to the "Filipino" time.  The sync
against Singapore is actually irrelevant because it is immediately
overridden by the second time sync.

You would get better results with your polling if you instead did...

# Build up list of servers in $SVLIST
SVLIST=""
for server in something.sg something.ph; do
    SVLIST="$SVLIST $server"
done
ntpdate $SVLIST

That would cause the ntpdate program to consider both NTP servers at
once; it would attempt to take the best time sync based on evaluating
them all.

In all the above cases, it is YOU that do all the polling.  ntpdate
doesn't poll; it just requests time information once.

Far and away better is to put the two servers into /etc/ntp.conf...

 server something.sg
 server something.ph

And start up ntpd, which will NOT run as a cron job, but which will
rather stay running all the time.  That would periodically (once time
seems stable, probably every five minutes or so) poll each of the
servers.
-- 
http://www3.sympatico.ca/cbbrowne/linux.html
"The true  measure of a  man is how he treats  someone who can  do him
absolutely no good." -- Samuel Johnson, lexicographer (1709-1784)
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list