I have a few dedicated servers and for some reason they are totally unable to mantain the time properly synchronized, every few days they start having differences of minutes in the clock. So I have to manually open Putty, connect, login, and run the ntpdate -u 0.ar.pool.ntp.org command on each of them.

Since there's no way I can do this every day because I'm quite busy, the question is exactly how can I create some kind of cron that auto-runs this command every day on each server. I have full root access to all servers, they have CentOs and DirectAdmin. Thanks.-

2 Answers 2


No need to use cron for this task. Much better to install and configure ntpd (special daemon for continuous time sync).

  1. sudo yum install ntp
  2. sudo chkconfig ntpd on
  3. sudo nano /etc/ntp.conf
  4. you are from Argentina, right? comment/remove all the default CentOS ntp servers, you can add your own time-servers for Argentina, for example

    server 0.ar.pool.ntp.org
    server 1.south-america.pool.ntp.org
    server 0.south-america.pool.ntp.org
  5. After you are done with the configuration, just start the ntp service: sudo service ntpd start

  6. To check if the NTP service is synchronizing:

    sudo ntpq -pn
    sudo tail -f /var/log/messages
  • In fact, ntp-date is just a stripped-down version of NTPD, used for one-shot sync. Apr 1, 2013 at 17:10
  • Thanks, but on one of the servers this didn't work, this is the tail result:Apr 1 21:46:37 v ntpd[3761]: Listening on interface eth1, Enabled Apr 1 21:46:37 v ntpd[3761]: kernel time sync status 0040 Apr 1 21:46:37 v ntpd[3761]: getaddrinfo: "::1" invalid host address, ignored Apr 1 21:46:37 v kernel: megasr[ahci]: unable to retreive proper sense data Apr 1 21:47:56 v kernel: ip_conntrack: table full, dropping packet. Apr 1 21:47:58 v kernel: megasr[ahci]: unable to retreive proper sense data Apr 1 21:48:30 v last message repeated 105 times
    – andreszs
    Apr 2, 2013 at 0:55
  • @Andrew, is was the 1st of April, nevermind
    – poige
    Apr 2, 2013 at 5:34
  • The only caution I'd add is that I consider ntpd's access restriction behavior pretty obtuse. support.ntp.org/bin/view/Support/… has flow chart documentation for locking it down. Nice if you have a firewall, a potential mandate if you don't.
    – astrostl
    Apr 2, 2013 at 19:51

Instead of using ntpdate which resets time hardly at once, consider using NTP daemon (ntp packet). It slows down or fastens system clock to match NTP-server.

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.