centos7 自动同步时间

rm -rf /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

vim /etc/sysconfig/clock

ZONE="Asia/Shanghai"
UTC=false
ARC=false
 
 
yum install -y ntp
systemctl start ntpd
systemctl enable ntpd
 
vim /etc/rc.d/rc.local
/usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
 
crontab -e
0 */1 * * * ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
posted @ 2019-12-11 11:59  Linus小跟班  阅读(683)  评论(0编辑  收藏  举报