Bill Jonas on Sat, 12 Jan 2002 18:40:13 +0100


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

Re: [PLUG] Time/Date problem


On Sat, Jan 12, 2002 at 12:08:24AM -0500, Naresh Reddy wrote:
> I though you need broadband to use the time servers (24/hours internet). I
> am on Dial-up, so I don't think thats possible for me.

If you connect a couple times a day or more you could make a small
script using rdate to synchronize with a time server and set the
hardware clock.  On debian, you can simply put the script (make sure the
file name does not contain a dot) in the /etc/ppp/ip-up.d directory.  It
might look something like this:

#!/bin/sh
rdate time.server.here
hwclock --systohc --utc #omit "--utc" if you have the BIOS clock set to
                        #local time

On other distributions, I think you just add the rdate and hwclock
commands to the end of the /etc/ppp/ip-up script.

The ip-up script contains commands that are to be run after a PPP
connection is established.  (Conversely, the ip-down script contains
commands to run after the PPP session is terminated.)  In Debian, the
last command in this script runs all the scripts in the ip-up.d
directory.  (Similarly, ip-down runs things in the ip-down.d directory.)
Your distribution may do things slightly differently.

The main drawback of rdate is that it does not keep track of and correct
the drift in the system clock.  The ntp daemon, once it's been run long
enough, figures out how much your clock typically drifts and adjusts for
you automatically.  I suppose you could instead create scripts to run
ntpd when you connect and stop it when you disconnect, too.

-- 
Bill Jonas    *    bill@billjonas.com    *    http://www.billjonas.com/

Developer/SysAdmin for hire!   See http://www.billjonas.com/resume.html

Attachment: pgpUmpLl7PRqA.pgp
Description: PGP signature