Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux 時間同步實作:NTPdate + Cron 定時校時 + 硬體時鐘同步

編輯:Linux 教學

透過系統級排程任務,每 5 分鐘同步一次網路時間並寫入硬體時鐘:

1. 編輯系統 Crontab

# vi /etc/crontab
*/5 * * * * root /usr/sbin/ntpdate <時間伺服器IP>; /usr/sbin/hwclock -w

說明:ntpdate 向上層時間源(如 AD 網域控制器)同步系統時間;hwclock -w 將系統時間寫入 CMOS 硬體時鐘,確保重開機後時間正確。

2. 啟動並設定開機自動啟動 Cron 服務

service crond start
chkconfig crond on

此做法確保所有客戶端與 AD 驗證系統時間一致,避免 Kerberos 認證失敗等時間敏感問題。

Copyright © Windows教程網 All Rights Reserved