一、linux設置開機同步時間
在/etc/init.d/下新建synchronized_date腳本,添加如下內容: #!/bin/bash #chkconfig: 345 63 37 /usr/sbin/ntpdate ntp1.aliyun.com >> /var/log/ntpdate.log 注釋: #chkconfig:345 63 37 (數字345是指在運行級別為3、4、5時啟動;數字63是指啟動的優先級;數字 37是指停止的優先級)
二、修改腳本屬性
在linux系統中修改腳本屬性 [root@node init.d]$ sudo chmod 755 synchronized_date
三、設置開機自啟動
使用chkconfig命令將腳本設置為開機自啟 配置腳本自啟動 [root@node init.d]$ sudo chkconfig --level 345 synchronized_date on