設置開機自動同步Internet時間,並作定時同步任務
1、修改時區
rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime vim /etc/sysconfig/clock ZONE="Asia/Shanghai" UTC=false ARC=false
2、安裝並設置開機自啟
yum install -y ntp
systemctl start ntpd
systemctl enable ntpd
3、配置開機啟動校驗
vim /etc/rc.d/rc.local /usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
4、配置定時任務
crontab -e 0 */1 * * * ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
轉載自:https://www.cnblogs.com/jifeng/p/10452009.html