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? ) :-(

9

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).

  • 1
    Or an alternative NTP daemon such as chrony. – Michael Hampton May 2 '16 at 7: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 ( serverfault.com/questions/359835/… ) and this ( serverfault.com/questions/225780/… ) :-( – auntyellow May 2 '16 at 7: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 2 '16 at 7:57
  • Thanks. I posted another question: serverfault.com/questions/774316/… – auntyellow May 2 '16 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.