how to auto-run ntdpdate command?
Solution 1:
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
server 0.ar.pool.ntp.org server 1.south-america.pool.ntp.org server 0.south-america.pool.ntp.org
After you are done with the configuration, just start the ntp service:
sudo service ntpd start
-
To check if the NTP service is synchronizing:
sudo ntpq -pn sudo tail -f /var/log/messages
Solution 2:
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.