NTPD

From SlackWiki
Revision as of 15:01, 30 August 2012 by Arfon (talk | contribs) (Undo revision 771 by Arfon (talk) - Removed 2007 stuff, fixed typos)
Jump to navigation Jump to search

Automating the time synchronization

You have two choices for automatic time updating, you can run ntpd all the time as a background process or you can have it run once in awhile (if you are tight on system resources).

Running ntpd all the time

Just enable rc.ntpd script:
chmod +x /etc/rc.d/rc.ntpd
After the script is enabled you probably will want ntpd to start immediately so, can either restart the system or manually start ntpd with:
/etc/rc.d/rc.ntpd start

Running ntpd once in awhile

You have many choices but the two best ones are:
1) Set up a cron job
2) Set up a /etc/rc.d/rc.local entry and update the time on start-up only.
Either way, you need to add the following commands into your cron job or rc.local script:
ntpdate pool.ntp.org <---(updates the time)
hwclock --systohc <------(saves the time to the hardware clock)



Manually updating the time

Issue the following commands:

ntpdate pool.ntp.org
hwclock --systohc



Choosing the right time server

On ntp.org you will find a complete list with the right time server for you. Let's say you live in germany, then you will choose de.pool.ntp.org. A complete List is available at http://support.ntp.org/bin/view/Servers/NTPPoolServers

DST changes

If your time is off due to DST changes, you must update the /etc/localtime file. You should be able to find a correct file on the internet and just replace the old /etc/localtime file.

PROBLEMS

PROBLEM: "Unable to contact time server:" error with KDE's Time Control Module.
FIX: Make sure ntpd is NOT running. If ntpd is running, manual ntp and KDE ntp updates will return errors due to ntpd having control of the ntp port.