LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2006, 05:10 PM   #1
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Rep: Reputation: 15
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'.
 
Old 11-17-2006, 05:45 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
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
 
Old 11-17-2006, 06:39 PM   #3
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Original Poster
Rep: Reputation: 15
perfect! just what i needed. thanks!
 
Old 11-18-2006, 08:23 AM   #4
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Put 2 clocks madmax1143 Linux - Software 2 07-21-2006 09:36 AM
my clocks are weird boxerboy Fedora 9 08-07-2005 10:38 PM
Syncronize Clocks newuser455 Linux - Newbie 2 07-15-2005 09:23 PM
XFree86 clocks error MACSRULE Linux - General 3 04-06-2004 05:31 AM
Synchronising servers' clocks Paulo Ges Linux - Hardware 1 09-05-2003 01:31 PM


All times are GMT -5. The time now is 01:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration