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.-
No need to use cron for this task. Much better to install and configure ntpd (special daemon for continuous time sync).
sudo yum install ntp
sudo chkconfig ntpd on
sudo nano /etc/ntp.conf
you are from Argentina, right? comment/remove all the default CentOS ntp servers, you can add your own time-servers for Argentina, for example
After you are done with the configuration, just start the ntp service:
sudo service ntpd start
To check if the NTP service is synchronizing:
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.