Linux ntpd and ntpdate service

6

3

Running ntsysv on my CentOS terminal show both ntpd and ntpdate checked. Is it redundant to have both service to run at start-up?

MegaNairda

Posted 2012-07-04T07:14:59.250

Reputation: 679

Answers

15

They do different things.

  • ntpdate is what you might consider "one shot mode". It runs once and updates the clock if it receives a response from the remote ntp server.
  • ntpd runs continuously and adjusts the clock slightly to account for drift and to stay in sync with the remote ntp server. ntpd (by default) will not make any adjustments greater than 2 seconds.

It's common to run ntpdate at system boot to ensure the clock is in sync and then run ntpd to keep it in sync. If for example when your computer boots, the clock is off by 3 seconds then ntpd would assume that it's too great a jump to adjust, and therefore do nothing. Your system would then drift even further out of sync.

bahamat

Posted 2012-07-04T07:14:59.250

Reputation: 5 130

0

The usual way is to run ntpdate before starting ntpd.

Ntpdate is not a service, but a command that sets the time from an ntp server. Then ntpd keeps the time synchronized. The reason for doing this is that ntpd exits if the time difference is too great.

fstx

Posted 2012-07-04T07:14:59.250

Reputation: 932

1Well ntpdate is listed among the services on ntsysv – MegaNairda – 2012-07-04T07:44:41.627

1I would guess that they wrapped a service around it to ensure that it runs before ntpd, but after the networking services it needs. – fstx – 2012-07-04T14:45:58.140