ntpdate
ntpdate allows you to update server time with ntp servers.
To install, run
1 |
apt install ntpdate |
To update server time, run
1 |
ntpdate ntp.ubuntu.com |
Example
1 2 3 |
root@ip-172-26-2-47:~# ntpdate ntp.ubuntu.com 3 Mar 20:32:54 ntpdate[17295]: adjust time server 91.189.91.157 offset -0.000047 sec root@ip-172-26-2-47:~# |
Auto Update Server time with cronjob
Method 1
1 2 |
echo "ntpdate time-a.nist.gov" > /etc/cron.daily/ntpdate chmod 755 /etc/cron.daily/ntpdate |
Method 2
Set following cronjob
1 |
30 22 * * * /usr/sbin/ntpdate -b -s 1.pool.ntp.org |