NTP 校時

freebsd

每日校時:

新增並編輯 /etc/periodic/daily/190.ntpdate 檔,內容如下:

#!/bin/sh

echo

echo '主機校時:'

/usr/sbin/ntpdate tick.stdtime.gov.tw

chmod   +x   /etc/periodic/daily/190.ntpdate

http://freebsd.lab.mlc.edu.tw/faq/ntpdate.shtml

CENTOS

yum install ntpdate

手動校時:

chkconfig ntpd on

service ntpd stop

ntpdate watch.stdtime.gov.tw

service ntpd start

自動每日校時:

vi /etc/cron.daily/ntpdate

內容:

#!/bin/sh

/usr/sbin/ntpdate pool.ntp.org 1> /dev/null 2>&1

然後:

#chmod +x /etc/cron.daily/ntpdate

#service crond restart

http://www.cyberciti.biz/faq/howto-install-ntp-to-synchronize-server-clock/ 這裏是說設定 ntpd 好就ok了。不必再設 cronjob

Ubuntu

sudo crontab -e

選 nano 編輯器。

加入:

0 0 * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1

存檔。

service cron restart