LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to synch my clocks? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-synch-my-clocks-502607/)

hank43 11-17-2006 04:10 PM

how to synch my clocks?
 
i have a few systems, none of the times match, most are within 15min which is bad but not death. another system is off by a few hrs and i don't have access to its bios screen.

what is an easy way to get the clocks in synch? i know ntp is out there but i don't want to start running another server. does ntp introduce security risks? maybe, maybe not, but i don't want to spend a weekend reading on it. hwclock seems to be a 'good enough' path. if once a month i need to correct it by 5 min, no big deal.

can you share your tips on hwclock and any 'gotchas'.

homey 11-17-2006 04:45 PM

You could grab the correct time off a network clock and update the hardware clock in this one liner...
Code:

su - -c "ntpdate ntp.nasa.gov ; hwclock --systohc"
Also, my FC6 system has /etc/sysconfig/clock where I make sure to use local time, not UTC ...
Code:

ZONE="America/New_York"
UTC=false
ARC=false


hank43 11-17-2006 05:39 PM

perfect! just what i needed. thanks!

Hangdog42 11-18-2006 07:23 AM

Quote:

Originally Posted by homey
You could grab the correct time off a network clock and update the hardware clock in this one liner...
Code:

su - -c "ntpdate ntp.nasa.gov ; hwclock --systohc"


BZZZZZZZZZZZZZZZZZZZZZZZZZZZ. Incorrect answer. Actually not incorrect, but not wholly correct either.

While the one-liner will work, for home systems you should NEVER point to a specific time server, particularly tier 1 systems like NASA or NIST. Those things get pounded, and if it keeps up, access is going to be restricted.

The correct way to use time servers is through the pool system. This points you at a set of servers and the load is distributed so no one server gets swamped. It is the polite way to keep your clocks synchronized.

So the correct answer here is:

su - -c "ntpdate 0.us.pool.ntp.org ; hwclock --systohc"

Of course you can adjust the pool server to reflect the country you live in.


All times are GMT -5. The time now is 09:17 AM.