Adjust System Clock by polling Network Time Protocol (NTP) server

Create below script /etc/cron.daily/ntpdate

Comment out the echo statements to avoid cron spewing out mail daily!

#!/bin/bash
#
# Update time daily
#
echo "hwclock: Before running ntpdate date: `hwclock -r`"
echo "rtclock: Before running ntpdate date: `date`"
/usr/sbin/ntpdate ntp.ubuntu.com pool.ntp.org
echo "hwclock: After running ntpdate date: `hwclock -r`"
echo "rtclock: After running ntpdate date: `date`"
echo " "
#
exit 0

Set Execute permissions

chmod 744 /etc/cron.daily/ntpdate

QR Code
QR Code tech:linux:others:ntp_update (generated for current page)