gabriel rosenkoetter on Sun, 13 Jan 2002 12:10:13 +0100


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

Re: [PLUG] Time/Date problem


On Sun, Jan 13, 2002 at 04:46:01AM -0500, Kuzman Ganchev wrote:
> You might want to run ntpdate when you connect though, so that you can set the
> time as soon as you connect, and then keep it right with ntpd. At least on my
> laptop, if ntpd is running, and I try to run ntpdate I get:

Periodic ntpdates (or rdates, for that matter) are probably
sufficient for a workstation.

> shuriken:/home/kuzman# ntpdate 128.118.46.3
> 13 Jan 10:43:17 ntpdate[2504]: the NTP socket is in use, exiting

Yep, and it doesn't lie. (Even if you told ntpdate to use an
alternate outgoing socket to connect to the remote machine, having
two programs try to modify the state of the hardware clock is almost
definitely a bad idea.)

> Of course it might be better to keep it running all the time, and upon
> connection to kill it, call ntpdate, and start it again. 

Yep again.

In my (NetBSD) world, this consists of:

/etc/rc.d/ntpd stop
/etc/rc.d/ntpdate start
/etc/rc.d/ntpd start

I'm guessing most Linux distros will be similarly easy to deal with.

Putting this in /etc/dhclient-exit-hooks (or whatever pump uses for
the same) would probably be a good idea. (You might want to wrap it
in a conditional based on whether or not the DHCP client actually
received a lease--any sane DHCP client will provide a shell variable
stating this--so that you don't try to run ntpdate and ntpd sans
connection.)

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpQvhOcQZaI5.pgp
Description: PGP signature