Chapter 19. Keeping Time with NTP
Keeping accurate time on a single PC, or on a LAN, is important for a number of reasons: maintaining accurate timestamps in logs, keeping databases happy, and ensuring that batch jobs and other automated processes run at the right times. Even more important than keeping precisely correct time is keeping all of your servers and workstations synchronized with each other.
Linux includes a motley collection of time and date utilities: ntpdate, hwclock.sh, date, 822-date, tzselect, tzsetup, vcstime, uptime, zdump, ddate, rdate, ctime, and doubtless several more. In olden times, we ran hwclock.sh, rdate, or ntpdate at boottime, or put them in cron jobs for periodic updating. ntp —the Network Time Protocol—replaces all of that. It is best to disable any of the other utilities that are set to run automatically, whether from rc*.d files or cron, and let ntp be your sole timekeeper. With one exception: ntpdate is still useful for making large corrections. If your system time is off by more than 20 or 30 minutes, ntp will take several hours, or even days, to correct it, whereas ntpdate takes care of large corrections instantly.
The command ntpd -g is supposed to replace ntpdate , but it doesn’t work well for corrections of more than an hour. If your system time is off by several hours, the ntp documentation tells you to correct it manually. If that works for you, fine; in this chapter, we’ll cover how to make the computer do the work.
ntp is implemented ...