How to update the hosts clock as part of cron daily?

Matthew Seaman matthew at FreeBSD.org
Tue Sep 8 14:12:07 UTC 2015


On 2015/09/08 14:57, Ernie Luzar wrote:

> My host motherboard clock is losing about 3 seconds a day.
> I have replaced the the motherboard battery but this did not help.
> So now I want to run "ntpd -q" or ntpdate once a day as part of
> cron:periodic:daily.
> I see 480.status-ntpd but no info on what it does or how to active if.
> 
> What is the normal practice to accomplish this?

ntpd is a system daemon, and you enable it like any other daemon:

Add this to /etc/rc.conf:

ntpd_enable="YES"
ntpd_sync_on_start="YES"

Then, one time only, start ntpd:

# service ntpd start

With these settings in /etc/rc.conf, ntpd will be started automatically
on boot.

You can monitor how well ntpd is controlling your clock by running 'ntpq
-p' -- where the 'delay' 'offset' and 'jitter' values are measured in
milliseconds.  ntpd will keep most modern machines with a decent network
connection within about 30ms of its time sources (and frequently it will
manage within about 5ms) once it has got itself properly synched.

Don't bother trying to run ntpdate or similar out of cron.  It isn't
effective.  Just leave ntpd running.

	Matthew



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 972 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20150908/0b16d307/attachment.bin>


More information about the freebsd-questions mailing list