How to Keep Your Server Clock Correct
Posted on September 25, 2006, under Development.
Making sure the clock on your server is accurate is more important than you might think. Everything from scripting languages like PHP, databases, and other applications that run on your server all go off of your server time. If it’s off by five, ten minutes you will have inaccurate times on entries in your database for your web applications; like blogs. There are several ways to accomplish keeping your server time in sync, I primary use linux servers and accomplish clock syncing with a simple cron job.
[code]
0 */12 * * * ntpdate clock1.unc.edu >/dev/null 2>&1
[/code]
With this cron job, every 12 hours your server will synchronize itself with a time server. You can search for other time server, but I have never had problems with the one above.
Popularity: 4% [?]
2 Replies to "How to Keep Your Server Clock Correct"
Roger on September 26, 2006
This is a very BAD recommendation as the previous poster Alex has mentioned - especially bad if you have any processes that require accurate time or are sensitive to significant clock shifts when running. You should only use ntpdate when your system is first booted and then use a time server daemon such as ntpd to keep the local clock in sync with the remote master time servers (use more than one). And do NOT use clock1.unc.edu - Geez!!! (how blissful must the original poster be)!! Use a public pooled or stratum 2 time server (http://ntp.isc.org/bin/view/Servers/WebHome).



Alex on September 26, 2006
Clock synchronization isn’t perfect. A large drift may occur that confuses processes, screws up logs and results in data loss. That is why you should use a daemon-based system like Chrony.