Unix Technical Forum

Synchronize system clock?

This is a discussion on Synchronize system clock? within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Le Sun, 17 Dec 2006 18:49:51 +0000, rm a écrit*: > Ivan Rajkovic <ivan@iep.physik.uni-essen.de> wrote: >> On Fri, 15 ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 02-20-2008, 08:22 PM
Loki Harfagr
 
Posts: n/a
Default Re: Synchronize system clock?

Le Sun, 17 Dec 2006 18:49:51 +0000, rm a écrit*:

> Ivan Rajkovic <ivan@iep.physik.uni-essen.de> wrote:
>> On Fri, 15 Dec 2006 11:59:10 +0100, Niki Kovacs wrote:
>>
>>> Hi,
>>>
>>> Is there a simple way to synchronize my system clock, say, on startup? My
>>> laptop unfortunately has a broken battery, and everytime I disconnect the
>>> power cable, the clock freezes... only to resume activity at the next
>>> boot... which always makes me travel back in time )
>>>
>>> Cheers,
>>>
>>> Niki

>>
>> put this is /etc/rc.d/rc.local :
>>
>> /usr/sbin/ntpdate de.pool.ntp.org
>> /sbin/hwclock -w
>>
>> you can change ntp server, here is the list:
>> http://ntp.isc.org/bin/view/Servers/WebHome

>
> We still use rdate. We include the following in rc.local:
>
> /usr/bin/rdate -s 129.6.15.29
>
> Is there a reason to use ntpd over rdate?


No special reason for the use you make of this command.
It is quite similar to ntpdate, a direct bulk call to
get the date/time from NTP server(s).
Now, exactly for the same reasons as ntpdate, if you intend to
put this command in cron (especially more often than a 24H basis)
please consider using ntpd instead.
You won't do much harm to the ntp servers for a long time but
you might have to find some new ntp servers and/or ISPs ;-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 02-20-2008, 08:22 PM
Thomas Overgaard
 
Posts: n/a
Default Re: Synchronize system clock?


Loki Harfagr wrote :

> Le Sun, 17 Dec 2006 18:49:51 +0000, rm a écrit*:


>> Is there a reason to use ntpd over rdate?

>
> No special reason for the use you make of this command.
> It is quite similar to ntpdate, a direct bulk call to
> get the date/time from NTP server(s).


One think is against rdate and that is the fact that rdate only supports
the old RFC-868 time protocol, so its a bit harder to find a server who
supports this protocol.
--
Thomas O.

This area is designed to become quite warm during normal operation.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 02-20-2008, 08:22 PM
Henrik Carlqvist
 
Posts: n/a
Default Re: Synchronize system clock?

james <mentor@arisia.org> wrote:
> I wrote an rc.ntpd with status|start|stop|restart with logging and a
> logrotate configuration.


That script seems really nice. However, I am missing one thing: A call to
ntpdate before ntpd is started. If I remember right ntpd refuses to start
if the clock is more than 3600 seconds wrong. 3600 seconds only means one
hour.

If you have a computer with a broken cmos battery or you don't have UTC
time in cmos clock and switched between daylight saving the time might
differ more than 1 hour from the correct time. With such a time difference
ntpd might refuse to start when it is needed the most. A call to ntpdate
fixes this.

Another thing to consider for the script might be to write the right time
back to the cmos clock with "hwclock -w". If the cmos battery is OK this
will give a rather accurate time at the next reboot. Without the "hwclock
-w" the time might be wrong at each reboot until ntp is started.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc8(at)uthyres.com Examples of addresses which go to spammers:
root@variousus.net root@localhost

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 02-20-2008, 08:23 PM
james
 
Posts: n/a
Default Re: Synchronize system clock?

Henrik Carlqvist <Henrik.Carlqvist@deadspam.com> wrote in
newsan.2006.12.18.07.12.35.562270@deadspam.com:

> james <mentor@arisia.org> wrote:
>> I wrote an rc.ntpd with status|start|stop|restart with logging and a
>> logrotate configuration.

>
> That script seems really nice. However, I am missing one thing: A call
> to ntpdate before ntpd is started. If I remember right ntpd refuses to
> start if the clock is more than 3600 seconds wrong. 3600 seconds only
> means one hour.


I believe that you're right, but since my 433MHz Celeron time server has
a good CMOS battery I haven't run across that problem yet. ;v)

> Another thing to consider for the script might be to write the right
> time back to the cmos clock with "hwclock -w". If the cmos battery is
> OK this will give a rather accurate time at the next reboot. Without
> the "hwclock -w" the time might be wrong at each reboot until ntp is
> started.


I think that my slackware version, version 10.0, handles that as part of
the reboot/poweroff scripts. Maybe???

Anyway, thanks for the kind words. You are, of course, free to
take/alter/re-publish the script as you wish.

After I wrote that I started checking out more of the ntp package.
There're a lot of other scripts in the package but they don't seem to
work, as if they were written for a different version or distribution.
I'm a little vague as that was a while ago now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:34 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com