centos8 时钟同步
-
加入开启启动
systemctl enable chronyd -
启动chronyd
systemctl start chronyd -
设置时区
\cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # -
设置NTP同步时间
timedatectl set-ntp true # -
修改时间
date -s “18:00” #
date -R -
重启服务
systemctl restart chronyd -
同步时间
chronyc sources -v #
date -R # 查看是否是当前时间 -
加入定时任务
echo “*/10 * * * * systemctl restart chronyd && chronyc sources -v” >> /var/spool/cron/root
参考:
https://blog.csdn.net/qq_42769013/article/details/105900383?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param