#9:55 20/07/2015
yum install ntp ntpdate ntp-doc | apt-get install ntp ntpdate ntp-doc
chkconfig ntpd on | systemctl enable ntpd.service
/etc/init.d/ntpd start | systemctl restart ntpd.service
crontab -e
#Sync Time Server, hourly:
* */1 * * * /opt/script/time-force-update.sh
mkdir -p /opt/script/
echo "ntpdate -u 0.ubuntu.pool.ntp.org"> /opt/script/time-force-update.sh
echo "ntpdate -u 1.ubuntu.pool.ntp.org">> /opt/script/time-force-update.sh
echo "ntpdate -u 2.ubuntu.pool.ntp.org">> /opt/script/time-force-update.sh
echo "ntpdate -u 3.ubuntu.pool.ntp.org">> /opt/script/time-force-update.sh
echo "ntpq -p" >>/opt/script/time-force-update.sh
cat /dev/null > /opt/script/get-date.log
chmod +x /opt/script/time-force-update.sh
/opt/script/time-force-update.sh
#View status: Use ntpq to see more info:
ntpq -p
#Source: https://help.ubuntu.com/lts/serverguide/NTP.html
No comments:
Post a Comment