[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setting hardware clock from NIST



brownh@hartford-hwp.com (Haines Brown) writes:

> I have an executable script, "time.rc" which has: 
>
>   #! /bin/bash
>   rdate -s time-b.nist.gov 
>   clock -w

It's almost certainly better to find a local time server and not
hammer on the NIST's; I'd also use ntp (ntp-simple package) to keep
your clock up-to-date while the system is running.  See
http://www.ntp.org/ for more information, and contact your ISP to see
if they have their own time server.

At any rate, on my system, the hardware clock is automatically updated
from the system clock at boot and shutdown time, by
/etc/init.d/hwclock.sh in the util-linux package.  So if you installed
and configured NTP, you'd get the same effect as this script.

> Second, where to put it? I placed a copy of my time.rc into
> /etc/init.d, and then created a symlink to it in /etc/rc2.d so that
> the hardware clock is reset on boot, and also in /etc/cron.daily, so
> that the clocks are reset daily according to NIST. Will this work; is
> there a better arrangement?

That setup is probably fine, though I'd do either a cron script or an
init.d script, not both (if your machine spends a lot of time shut
down, anacron can run delayed cron jobs at boot time).  If you do want
an init script, I'd also make it more policy-compliant; try working
from /etc/init.d/skeleton.

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: