linux设置开机同步时间

在/etc/init.d/下新建zhjdate脚本,添加如下内容:

#!/bin/bash
# chkconfig: 345 63 37
#chkconfig:345 63 37 (数字345是指在运行级别为3、4、5时启动;数字63是指启动的优先级;数字 37是指停止的优先级)
/usr/sbin/ntpdate us.pool.ntp.org >> /var/log/ntpdate.log

STEP 2:修改脚本属性
#chmod 755 zhjdate
STEP 3:配置脚本自启动
#chkconfig --level 345 zhjdate on

原文地址:https://www.cnblogs.com/tv151579/p/6961864.html