2

Is there a linux service that can synchronize system time with a NTP server with a given interval, such as 1 minute, 1 hour or 1 day ?

Is it a good practice to run utpdate in a cron tab? e.g.

*/10 * * * * /usr/sbin/ntpdate us.pool.ntp.org

UPDATE

In my server the ntpd service is started but it does not seem to work. Where can I see ntpd working status (log or message) ? I can find nothing according to this ( Where are the ntpd log file located, and how can we configure the ntpd log file path? ) and this ( Where can I look up for the ntpd log? ) :-(

auntyellow
  • 167
  • 1
  • 3
  • 9

1 Answers1

10

No. It is good practice to run ntpd, because that is what it is for - to continuously keep your time as precisely sync'ed to correct time as possible, with the assistance of one or more reference servers (or, with acknowledgement to Michael, some other NTP daemon).

ntpdate's job is to brutally wrench the system clock into something close to correctness, which helps the daemon to keep it there; but this is not a good thing to do under a running system, which is why it's generally only done at boot time.

(Note that I have been quite precise in my choice of words, since you are making two mistakes about NTP: firstly, by not running the daemon, and secondly, in thinking that NTP exists to synch one server's clock to another, when it actually tries to divine the correct time, and sync to that).

MadHatter
  • 78,442
  • 20
  • 178
  • 229
  • 1
    Or an alternative NTP daemon such as chrony. – Michael Hampton May 02 '16 at 07:01
  • In my server the **ntpd** service is started but it does not seem to work. Where can I see ntpd working status (log or message) ? I can find nothing according to this ( http://serverfault.com/questions/359835/where-are-the-ntpd-log-file-located-and-how-can-we-configure-the-ntpd-log-file ) and this ( http://serverfault.com/questions/225780/where-can-i-look-up-for-the-ntpd-log ) :-( – auntyellow May 02 '16 at 07:25
  • 3
    Honestly, "*How do I make ntpd work*" is a completely different question to "*Should I run ntpdate continuously*", and if this question changes into the other, my answer (given in good faith) is meaningless. If I were you I'd accept an answer to this question, to put it to bed, and open a new question asking why your `ntpd` doesn't sync, (a) noting that you're running `ntpdate` (please provide output), and (b) giving your *unredacted* `ntp.conf` and outputs of `ntpq -c as` and `ntpq -c pe` (after giving `ntpd` ten minutes to sync). – MadHatter May 02 '16 at 07:57
  • Thanks. I posted another question: http://serverfault.com/questions/774316/where-can-i-see-ntpd-working-status-log-or-message – auntyellow May 02 '16 at 13:48