Setting my hardware clock to atomic clock?

Setting my hardware clock to atomic clock?

Post by Dan Jacobso » Wed, 20 Dec 2000 02:29:10








> >> I want to use cron to run a util to check the time via the net and
> >> set my clock when/if there's a difference in the hardware clock.

> > Hi Larry, This one works for me.  This sets the OS time and the BIOS
> > time.

> > rdate -s clock-1.cs.cmu.edu && hwclock --systohc

> Another command that does the same job is ntpdate. And why use cron
> when the only time you'll want it to run is when you connect? What I
> did was create /etc/ppp/ip-up.local which contains
>   ntpdate ntp0.freeserve.net && hwclock --systohc
> The ip-up.local script is called from /etc/ppp/ip-up which is run
> whenever ppp connects to the net. cron would be of more use if you were
> connected to a LAN with an NTP server.

by the way, in man hwclock it says

       To see if it is on or off, use the command adjtimex --print and
       look at the value of "status".  If the "64" bit of this number
       (expressed in binary) equal to 0, 11 minute mode is on.
       Otherwise, it is off.

and I do
$ /sbin/adjtimex -p
[...]     status: 64
which makes me wonder what the English of the man page is trying to
say.  Does "status:64" mean the 11 minute thing is on or off?

by the way, the The Clock Mini-HOWTO looked promising, but
seemed not to tell us dummies exactly what to do simplewise.

I installed the ntp rpm from the 2nd mandrake 7.2 CD
and notices that it doesn't put its man pages on the system, but one can dig
them
out of its 'doc' directory... as seen in rpm -ql ntp
--
www.geocities.com/jidanni E-mail: restore ".com."  ?n|
Tel:+886-4-5854780; starting in year 2001: +886-4-25854780

 
 
 

Setting my hardware clock to atomic clock?

Post by Bill Unr » Wed, 20 Dec 2000 09:33:02








>> >> I want to use cron to run a util to check the time via the net and
>> >> set my clock when/if there's a difference in the hardware clock.
>>   ntpdate ntp0.freeserve.net && hwclock --systohc

A better option is to use chrony. It can both keep track of your
hardware clock so that it can set the system clock accurately on bootup
even if your hardware clock drifts, and go onto the net to use atomic
clocks to keep your system withing afew milliseconds of accurate time.

You set it up so that it goes on net only when you are connected using
the ip-up and ip-down script.

/etc/chrony.conf
server   x.x.x.x offline
driftfile /etc/chrony.drift
logdir /var/log/chrony
log tracking
keyfile /etc/chrony.keys
commandkey 25
maxupdateskew 100.0
dumponexit
dumpdir /var/log/chrony
rtcfile /etc/chrony.rtc
initstepslew 30 x.x.x.x

where x.x.x.x is the ip of an ntp server.

/etc/chrony.keys
25 yyyyyyyy

(this is your password to be able to carry out commands with chronyc)

/etc/ip-up.local
chronyc<<EOF
password yyyyyyyy
online
EOF

/etc/ppp/ip-down
chronyc<<EOF
password yyyyyyyy
offline
EOF

And in /etc/rc.d/rc.local put

chrony  -r -s

instead of the clock intialisation routines there (hwclock)

 
 
 

Setting my hardware clock to atomic clock?

Post by Robert Jone » Wed, 20 Dec 2000 21:14:49









> >> >> I want to use cron to run a util to check the time via the net and
> >> >> set my clock when/if there's a difference in the hardware clock.

> >>   ntpdate ntp0.freeserve.net && hwclock --systohc

> A better option is to use chrony. It can both keep track of your
> hardware clock so that it can set the system clock accurately on bootup
> even if your hardware clock drifts, and go onto the net to use atomic
> clocks to keep your system withing afew milliseconds of accurate time.

> You set it up so that it goes on net only when you are connected using
> the ip-up and ip-down script.

> /etc/chrony.conf
> server   x.x.x.x offline
> driftfile /etc/chrony.drift
> logdir /var/log/chrony
> log tracking
> keyfile /etc/chrony.keys
> commandkey 25
> maxupdateskew 100.0
> dumponexit
> dumpdir /var/log/chrony
> rtcfile /etc/chrony.rtc
> initstepslew 30 x.x.x.x

> where x.x.x.x is the ip of an ntp server.

> /etc/chrony.keys
> 25 yyyyyyyy

> (this is your password to be able to carry out commands with chronyc)

> /etc/ip-up.local
> chronyc<<EOF
> password yyyyyyyy
> online
> EOF

> /etc/ppp/ip-down
> chronyc<<EOF
> password yyyyyyyy
> offline
> EOF

> And in /etc/rc.d/rc.local put

> chrony  -r -s

> instead of the clock intialisation routines there (hwclock)

Thanks for posting concise instructions for chrony.  I attempted to set it up when I first
started using Linux, failed miserably and went with ntpdate instead.

--
People never lie so much as after a hunt, during a war, or before an election.
                -- Otto Von Bismarck

  6:09am  up 66 days, 36 min,  2 users,  load average: 0.00, 0.02, 0.00

 
 
 

Setting my hardware clock to atomic clock?

Post by Ulrich Wind » Wed, 20 Dec 2000 21:26:57








> > >> I want to use cron to run a util to check the time via the net and
> > >> set my clock when/if there's a difference in the hardware clock.

> > > Hi Larry, This one works for me.  This sets the OS time and the BIOS
> > > time.

> > > rdate -s clock-1.cs.cmu.edu && hwclock --systohc

> > Another command that does the same job is ntpdate. And why use cron
> > when the only time you'll want it to run is when you connect? What I
> > did was create /etc/ppp/ip-up.local which contains
> >   ntpdate ntp0.freeserve.net && hwclock --systohc
> > The ip-up.local script is called from /etc/ppp/ip-up which is run
> > whenever ppp connects to the net. cron would be of more use if you were
> > connected to a LAN with an NTP server.

> by the way, in man hwclock it says

>        To see if it is on or off, use the command adjtimex --print and
>        look at the value of "status".  If the "64" bit of this number
>        (expressed in binary) equal to 0, 11 minute mode is on.
>        Otherwise, it is off.

The FAQ explains the status bits and the story behind the 11
minutes.  See STA_UNSYNC.

- Show quoted text -

Quote:

> and I do
> $ /sbin/adjtimex -p
> [...]     status: 64
> which makes me wonder what the English of the man page is trying to
> say.  Does "status:64" mean the 11 minute thing is on or off?

> by the way, the The Clock Mini-HOWTO looked promising, but
> seemed not to tell us dummies exactly what to do simplewise.

> I installed the ntp rpm from the 2nd mandrake 7.2 CD
> and notices that it doesn't put its man pages on the system, but one can dig
> them
> out of its 'doc' directory... as seen in rpm -ql ntp
> --
> www.geocities.com/jidanni E-mail: restore ".com."  ?n|
> Tel:+886-4-5854780; starting in year 2001: +886-4-25854780

 
 
 

Setting my hardware clock to atomic clock?

Post by Bob Bawcut » Fri, 22 Dec 2000 14:10:31









> >> >> I want to use cron to run a util to check the time via the net and
> >> >> set my clock when/if there's a difference in the hardware clock.

> >>   ntpdate ntp0.freeserve.net && hwclock --systohc

> A better option is to use chrony. It can both keep track of your
> hardware clock so that it can set the system clock accurately on bootup
> even if your hardware clock drifts, and go onto the net to use atomic
> clocks to keep your system withing afew milliseconds of accurate time.

> You set it up so that it goes on net only when you are connected using
> the ip-up and ip-down script.

> /etc/chrony.conf
> server   x.x.x.x offline
> driftfile /etc/chrony.drift
> logdir /var/log/chrony
> log tracking
> keyfile /etc/chrony.keys
> commandkey 25
> maxupdateskew 100.0
> dumponexit
> dumpdir /var/log/chrony
> rtcfile /etc/chrony.rtc
> initstepslew 30 x.x.x.x

> where x.x.x.x is the ip of an ntp server.

> /etc/chrony.keys
> 25 yyyyyyyy

> (this is your password to be able to carry out commands with chronyc)

> /etc/ip-up.local
> chronyc<<EOF
> password yyyyyyyy
> online
> EOF

> /etc/ppp/ip-down
> chronyc<<EOF
> password yyyyyyyy
> offline
> EOF

> And in /etc/rc.d/rc.local put

> chrony  -r -s

> instead of the clock intialisation routines there (hwclock)

Hi,
I'm also trying to have my hardware clock use the net for updates but I'm a new bee and
therefore limited - for now.
I tried the two command mentioned in this thread (rdate & ntpdate) from a Konsole but neither
command was found. I'm running 7.1 so maybe that  makes a difference.
Any suggests? I'd like to just get it to run from a command line first then move up to a cron
job later. Oh ya,  I'm on cable so I don't run PPP.
Thanks in advance the help

    Regards,
        Bob

 
 
 

Setting my hardware clock to atomic clock?

Post by Prasanth A. Kum » Fri, 22 Dec 2000 14:23:12


<snip>

Quote:> Hi, I'm also trying to have my hardware clock use the net for updates
> but I'm a new bee and therefore limited - for now.  I tried the two
> command mentioned in this thread (rdate & ntpdate) from a Konsole but
> neither command was found. I'm running 7.1 so maybe that makes a
> difference.  Any suggests? I'd like to just get it to run from a
> command line first then move up to a cron job later. Oh ya, I'm on
> cable so I don't run PPP.  Thanks in advance the help

>     Regards,
>         Bob

I use xntp3 on my system (and I use cable modem like you) and it is
much more automated and easy to setup. Anyway, install the appropriate
package for this program (eg. xntp3 RPM under Red Hat) and edit the
configuration file /etc/ntp.conf with something like this:

driftfile /etc/drift
server <time server 1 ip>
server <time server 2 ip>
server <time server 3 ip>
authenticate no

No start up the time server using whatever is in your bootup script
(eg. in Red Hat you do /etc/rc.d/init.d/xntpd restart) and wait a few
minutes till it synchronized and then type 'ntptrace' and it will
estimate how close it is tracking to the other clock. If you run this
before it synchronizes, it will give some kind of error. This program
is quite sophisticated in that it will allow backup time servers and
will even store drift values in a file so if you lose the connection
to the net, it will keep on correcting based on this old drift values!
So that means after you get it all working, leave the computer on for
a couple hours so it get a good estimate of the drift value for future
use.

--
Prasanth Kumar

 
 
 

Setting my hardware clock to atomic clock?

Post by Ulrich Wind » Fri, 22 Dec 2000 16:16:22


[...]

Quote:> Hi,
> I'm also trying to have my hardware clock use the net for updates but I'm a new bee and
> therefore limited - for now.
> I tried the two command mentioned in this thread (rdate & ntpdate) from a Konsole but neither
> command was found. I'm running 7.1 so maybe that  makes a difference.

You were "root", were you? These commands may be is a special
directory like /usr/sbin, so an ordinary user won't use them by
default. If you were root, have you checked whether your installation
media has additional network add-ons? I know this sounds trivial, but
you said you are a beginner.

rdate is available from many sources. Use a search engine to find some.

When desperate try http://www.ntp.org/ for a great time ;-)

Quote:> Any suggests? I'd like to just get it to run from a command line first then move up to a cron
> job later. Oh ya,  I'm on cable so I don't run PPP.
> Thanks in advance the help

>     Regards,
>         Bob

 
 
 

Setting my hardware clock to atomic clock?

Post by Jean-David Beye » Fri, 22 Dec 2000 20:58:28




> [...]
> > Hi,
> > I'm also trying to have my hardware clock use the net for updates but I'm a new bee and
> > therefore limited - for now.
> > I tried the two command mentioned in this thread (rdate & ntpdate) from a Konsole but neither
> > command was found. I'm running 7.1 so maybe that  makes a difference.

> You were "root", were you? These commands may be is a special
> directory like /usr/sbin, so an ordinary user won't use them by
> default. If you were root, have you checked whether your installation
> media has additional network add-ons? I know this sounds trivial, but
> you said you are a beginner.

> rdate is available from many sources. Use a search engine to find some.

I run rdate up to 4x a day from cron. On my Red Hat 6.0 machines, it is
in /usr/bin/rdate and there is a man page for it.

--
 .~.  Jean-David Beyer           Registered Linux User 85642.
 /V\                             Registered Machine    73926.
/( )\ Shrewsbury, New Jersey
^^-^^ 6:55am up 16 days, 15:42, 3 users, load average: 2.10, 2.12, 2.04

 
 
 

Setting my hardware clock to atomic clock?

Post by drax6 » Sat, 23 Dec 2000 06:37:00


...
Quote:

> Hi,
> I'm also trying to have my hardware clock use the net for updates but I'm
> a new bee and therefore limited - for now.
> I tried the two command mentioned in this thread (rdate & ntpdate) from a
> Konsole but neither
> command was found. I'm running 7.1 so maybe that  makes a difference.
> Any suggests? I'd like to just get it to run from a command line first
> then move up to a cron
> job later. Oh ya,  I'm on cable so I don't run PPP.
> Thanks in advance the help

>     Regards,
>         Bob

You have permanent internet connection, so you can do the same I did. BTW,
do you try to run "ntpdate" as user or root? ntpdate is in /usr/sbin, so
it's not in ordinary user's PATH.

Do everything below as root.
I created a scipt in /usr/local/bin, called "adj_time.sh":
-------
#!/bin/sh
ntpdate ntp0.freeserve.net && hwclock --systohc    
-------
Then, running "crontab -e" add the following line:

0 0 * * * /usr/local/bin/adj_time.sh

This will update your time once a day at midnight.

And, don't forget to "chmod a+x /usr/local/bin/adj_time.sh" !

 
 
 

1. Want to have an atomic clock sync your Linux box clock ?

Easy, just add:-

"0 12 * * *    /usr/sbin/rdate -s 129.6.15.28"

tp your root crontab, and everyday your clock will be
updated at midday. You may not have the "rdate"
program installed, or it may nor be in /usr/bin
as it is on my Debian system.

To find out if "rdate" is on your Linux box, just
try "locate rdate".

What is 129.6.15.28 ?

National Institute of Standards and Technology (NET-NBS)
   100 Bureau Drive Stop 8953
   Gaithersburg, MD 20899-8953
   US

   Netname: NIST
   Netblock: 129.6.0.0 - 129.6.255.255

--
                 _
               .' `.              Free Micro Burner
               |a_a|   http://w3w.arafuraconnect.com.au/~tp/burn.html
  Debian       \ V /
  2.2.20      /(   )\      Linux Registration Number: 103931
             |\`> < /\           http://counter.li.org
             \_|=='|_/
* OSS is long-term credible ... FUD tactics can not be used to combat it.

2. SMP enabled apps for linux?

3. How do it synchronize my system clock with an atomic clock ?

4. pop3

5. udb, hardware clock and 'clock -w'

6. DVD-video display problem

7. hwclock (system clock to hardware clock)???

8. Hard drive problems

9. Red Hat 6.0 System Clock vs. Hardware Clock

10. System clock MUCH slower than hardware clock

11. Hardware clock OK, system clock losing 15 mins daily

12. help setting time with atomic clock

13. Atomic clock setting program