centos7 时间自动同步

设置开机自动同步Internet时间,并做定时同步任务
一、修改时区java

rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
vim /etc/sysconfig/clock
ZONE="Asia/Shanghai"
UTC=false
ARC=false

二、安装并设置开机自启vim

yum install -y ntp
systemctl start ntpd
systemctl enable ntpd

三、配置开机启动校验blog

vim /etc/rc.d/rc.local
/usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w

四、配置定时任务crontab

crontab -e
0 */1 * * * ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
相关文章
相关标签/搜索