Linux系统时间错误如何自动同步?

Linux系统时间错误如何自动同步?

日常维护中也经常会遇到服务器时间不一致的问题,今天给大家介绍一种linux系统自动更新时间的方法。

安装NTP/修正本地时区

[root@VM_0_13_centos ~]# yum -y install ntp
[root@VM_0_13_centos ~]# rm -rf /etc/localtime
[root@VM_0_13_centos ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@VM_0_13_centos ~]# /usr/sbin/ntpdate -u pool.ntp.org

设置自动同步时间

#表示每10分钟同步一次
[root@VM_0_13_centos ~]# crontab -e
*/10 * * * *  /usr/sbin/ntpdate -u pool.ntp.org >/dev/null 2>&1
[root@VM_0_13_centos ~]# service crond restart #重启
[root@VM_0_13_centos ~]# date #查看时间

原创文章,如若转载,请注明出处:https://www.misuan.com/1330.html

(0)
上一篇 2021年8月10日 12:59:59
下一篇 2021年8月14日 17:15:42

相关推荐

发表回复

登录后才能评论