> learn ntpd. it's not that hard...
Newsgroups: comp.os.linux,comp.os.linux.networking,comp.os.linux.security
> learn ntpd. it's not that hard...
I would suggest xntpd though, I think that theprocess goes something like this:
su ntsysv
— check to make sure neither ntpd nor xntpd are running, if they are then do a 'ps aux | grep ntp' and kill the processes
timconfig
— make sure you are set to GMT and your zone is correct
vi /etc/ntp.conf
you'll want to put an instance of the following, nore won't hurt, but it's not necessary:
server <server IP>
then a couple of these:
peer <server IP> peer <server IP>
that will allow you to 'triangualte' your virtual position.
you put a:
driftfile <location of driftfile>
if you want to log your connections.
then an
authenticate no
should round out the file. (I usually don't authenticate, you can if you're really protective of your time though)
then run 'ntpdate <server>' or something like that to get your computer's clock set.
then I think that it is 'hwclock —utc —systohc' to set your computer's hardware time to the same as the computer's virtual time.
then you shoudl be able to
/etc/init.d/xntpd start
to get everythign running.
That's all off the top of my head, but it should at least set you in the right direction.
AngryBob
the rdate daemon is a default part of the Red Hat install.
Get one computer accurate (by NTP or rdate to the US naval observatory or some such) and then have each other machine call the "master." Put the following in each "slave" machines crontab:
10 11,23 * * * rdate -s dragon # accurate master machine 12 11,23 * * * hwclock --systohc # make it permanent
clock -w
Note that the clock command should be more than a minute after the rdate in case the rdate advances the clock by more than a minute; a minute is the most imaginable clock drift in a twelve hour period.
The "master_machine" entry should be the NTP or rdate host on your local network.
Cheers,
Russ Bixby, geek at large
rdate under solaris is just rdate hostname. But the rdate command under linux should be rdate -s (to set the time rather than just display it)
root@iitrc:~# crontab -l [...] # sync time with dragon 12 11,23 * * * rdate dragon
T
> Is there a list of definitive ntp servers on the internet?
See: http://www.eecis.udel.edu/~ntp[]
Nollaig MacKenzie
documented on: 2000.10.30 Mon 19:00:38
Newsgroups: alt.os.linux.mandrake,comp.os.linux.misc,comp.protocols.time.ntp
> >> 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
Dan Jacobson
> > >> 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)
Bill Unruh
> Any suggests? I'd like to just get it to run from a command line first > then move up to a cron
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
Newsgroups: linux.redhat.misc
>Anyone know of Linux software that will connect to an atomic clock and >synchronize the PC's clock with it? I need one that will work from the >command line in a cron job.
rdate -p -s 132.163.135.130
will link you to the National Institute of Standards & Technology and sync you with their atomic clock. If you add:
132.163.135.130 nist
to your /etc/hosts file you can shorten it to:
rdate -p -s nist
tom.hoffmann@…
What you really want to use is ntp. It might look intimidating, but it's actually quite easy to set up. You run the ntpd which queries a public network time server every at regular intervals (typically 128 seconds) as long as you're connected to the internet. As a matter of netiquette, you should sync to a secondary time server; you're box isn't important enough to sync to a primary time server or to the NIST or USNO clock.
If you're using redhat, don't use the RPM that came with 7.0, but find a more recent version from rpmfind.net (I'm using ntp-4.0.99k-1), or compile from source.
Everything you need to know is at http://www.eecis.udel.edu/~ntp/