hi how can I set the time and the date on FC3 from command line BR
On Wed, Dec 27, 2006 at 15:50:45 -0500, Brad Bonkoski bbonkoski@mediaguide.com wrote:
eng.waleed wrote:
hi how can I set the time and the date on FC3 from command line BR
man date
You also will want to use hwclock to set the motherboard clock so that if your machine crashes before the next clean shutdown, the clock doesn't get set back to a bad value.
eng.waleed:
how can I set the time and the date on FC3 from command line
Brad Bonkoski:
man date
An alternative is ntpdate. That'll set your clock according to a server, rather than you doing so against your wristwatch. You use it with the name of a NTP server (see the man file for it).
e.g. ntpdate pool.ntp.org
NB: It doesn't want to work while you've got an NTP server running on the same box. If you have, service ntpd stop, would stop it. You could then restart it, afterwards.
Tim wrote:
eng.waleed:
how can I set the time and the date on FC3 from command line
Brad Bonkoski:
man date
An alternative is ntpdate. That'll set your clock according to a
I use this little script (as root)
rdate -p -s time.nist.gov /sbin/hwclock --systohc
Mike
On Fri, 29 Dec 2006, Mike McCarty wrote:
Tim wrote:
eng.waleed:
how can I set the time and the date on FC3 from command line
Brad Bonkoski:
man date
An alternative is ntpdate. That'll set your clock according to a
I use this little script (as root)
rdate -p -s time.nist.gov /sbin/hwclock --systohc
and maybe add to /etc/crontab
0 * * * * root (rdate -p -s -u 192.43.244.18 ; hwclock --systohc) > /dev/null 2>&1
Tim wrote:
An alternative is ntpdate. That'll set your clock according to a server, rather than you doing so against your wristwatch. You use it with the name of a NTP server (see the man file for it).
e.g. ntpdate pool.ntp.org
NB: It doesn't want to work while you've got an NTP server running on the same box. If you have, service ntpd stop, would stop it. You could then restart it, afterwards.
You can use the -u option to ntpdate and it will work while the ntp daemon is running.
On Friday 29 December 2006 02:13, Tim wrote:
eng.waleed:
how can I set the time and the date on FC3 from command line
Brad Bonkoski:
man date
An alternative is ntpdate. That'll set your clock according to a server, rather than you doing so against your wristwatch. You use it with the name of a NTP server (see the man file for it).
e.g. ntpdate pool.ntp.org
NB: It doesn't want to work while you've got an NTP server running on the same box. If you have, service ntpd stop, would stop it. You could then restart it, afterwards.
Or, in the case of the majority of the ntpd scripts that I've read through, this will be done by the act of restarting ntpd, as the script, on startup, first calls ntpdate to crash-set the clock to somewhere near the right time before ntp actually starts maintaining it. Therefore, no need to try calling ntpdate, just "service ntpd restart" the script. A tail -f on the log will then allow you to watch its performance. However it appears that recent changes to ntpd have resulted in a quieter utility, so if one really wants to watch how ntpd is working, this simple script will show you:
------------ #!/bin/bash while true do sleep 1800 #half an hour, adjust to suit ntpq -p >>/var/log/ntp.log echo -n "drift=" >>/var/log/ntp.log cat /var/lib/ntp/drift >>/var/log/ntp.log done end -----------
Run this, then put a tail -f on /var/log/ntp.log and see this:
remote refid st t when poll reach delay offset jitter ============================================================================== *blackmage.ki.ii 195.111.99.186 2 u 96 128 377 149.365 7.647 0.805 +207-234-157-41. 209.51.161.238 2 u 77 128 377 73.404 5.652 0.776 +dehhs50srv0.oni 130.133.1.10 2 u 64 128 377 164.037 -1.142 2.796 LOCAL(0) .LOCL. 10 l 16 64 377 0.000 0.000 0.001 drift=64.826 remote refid st t when poll reach delay offset jitter ============================================================================== *blackmage.ki.ii 195.111.96.158 2 u 99 128 377 150.000 7.268 0.800 +207-234-157-41. 209.51.161.238 2 u 76 128 377 73.964 5.036 0.476 +dehhs50srv0.oni 192.53.103.108 2 u 70 128 377 165.476 1.806 1.547 LOCAL(0) .LOCL. 10 l 9 64 377 0.000 0.000 0.001 drift=64.826 remote refid st t when poll reach delay offset jitter ============================================================================== *blackmage.ki.ii 195.111.99.186 2 u 239 256 377 149.356 4.715 0.744 +207-234-157-41. 209.51.161.238 2 u 215 256 377 74.092 3.867 0.805 +dehhs50srv0.oni 194.25.115.122 2 u 207 256 377 165.900 4.364 3.891 LOCAL(0) .LOCL. 10 l 56 64 377 0.000 0.000 0.001 drift=65.190
Of course, once one is happy with the timekeeping, all this can be ignored. The timing figures shown are I believe, in milliseconds. Needless to say, I set my watches and clocks from the computer around here. :)