Re: Change the time and date

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

 



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. :)

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Yahoo.com and AOL/TW attorneys please note, additions to the above
message by Gene Heskett are:
Copyright 2006 by Maurice Eugene Heskett, all rights reserved.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux