ntpdate

ntpdate allows you to update server time with ntp servers.

To install, run

apt install ntpdate

To update server time, run

ntpdate ntp.ubuntu.com

Example

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

echo "ntpdate time-a.nist.gov" > /etc/cron.daily/ntpdate
chmod 755 /etc/cron.daily/ntpdate

Method 2

Set following cronjob

30	22	*	*	*	/usr/sbin/ntpdate -b -s 1.pool.ntp.org

time

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *