linux同步时间

Posted guzhensheng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux同步时间相关的知识,希望对你有一定的参考价值。

linux时间有两个。一个是系统时间,一个是硬件时间!

同步国家时间的时候会出现报错:no server suitable for synchronization found

现在国家授权的   210.72.145.44   暂时不能使用

本文章主要讲ntpdate:

一、安装ntp     yum install ntp -y

二、更改时区

cp -y /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

vim /etc/sysconfig/clock

ZONE="Asia/Shanghai"
UTC=false
ARC=false

三、同步时间

/usr/sbin/ntpdate -u cn.pool.ntp.org

四、写入硬件时间

hwclock -w

 

自动时间同步

1、配置开机启动校验

vi /etc/rc.d/rc.local 

/usr/sbin/ntpdate -u cn.pool.ntp.org> /dev/null 2>&1; /sbin/hwclock -w

2、配置定时任务

00 10 * * * root /usr/sbin/ntpdate -u cn.pool.ntp.org > /dev/null 2>&1; /sbin/hwclock -w

 



以上是关于linux同步时间的主要内容,如果未能解决你的问题,请参考以下文章

linux时间不同步会影响挂载吗?

Linux系统之时间同步方法

linux时间同步

Linux 同步时间 设置时区

Linux 时间同步

linux时间同步服务器的时间更新问题