Google +    Album

= Linux網路校時 =

以root身份執行:
ntpdate time.stdtime.gov.tw

正常執行的結果如下
27 Feb 16:55:46 ntpdate[27795]: step time server 220.130.158.52 offset -48.524717 sec

------------

/usr/sbin目錄找出ntpdate,

同樣以root身份執行:
/usr/sbin/ntpdate -s time.stdtime.gov.tw

參數 s 代表將執行後的messages交由 syslog 來記錄,
記錄在 /var/log/messages檔案。

補充:ntpdate 程式的作用...
向 NTP Server 詢問時間,並設定 Local date and time.
是一個 client 的程式.適合在開機時放在 /etc/rc.local 檔中,
或是利用 cron 來每隔一段時間校正一次.
若是求得的誤差時間超過 0.5 秒,便執行 settimeofday,直接設定時間.
若差別超過 0.5 秒,則執行 adjtime 來修正系統 clock.

------------

若要每日進行時間校正,可以寫入 cron
# vi /etc/crontab加入
10 5 * * * root /usr/sbin/ntpdate time.stdtime.gov.tw ; /sbin/hwclock -w
之後每天 5:10 Linux 系統就會自動的進行網路校時

------------
寫入BIOS
/usr/sbin/ntpdate stdtime.sinica.edu.tw
clock -w

沒有留言: