linux系统时间修改及网络时间同步

143 阅读1分钟

\

很多时候,会由于服务器 时间,与北京时间不同步,导致一些异常 / Bug 。

\

所以,需要去及时同步服务器时间 。

\

/

\

怎么操作呢 ?

非常简单 。

\

/

\

1. 寻找一个网络时间服务器,比如一些国家授时中心
微软公司授时主机(美国)
time.windows.com
台警大授时中心(台湾)
asia.pool.ntp.org
中科院授时中心(西安)
210.72.145.44
网通授时中心(北京)
219.158.14.130\

\

2.怎样去同步授时中心的时间
ntpdate asia.pool.ntp.org\

上面此命令就是去同步授时中心的时间\

\

3. 如果要让系统每天23:00去同步,这样可以使用上面所将的crontab设置计划同步
如下命令
#crontab -e
进入crontab编辑模式,使用方法同vi


输入 0 23 * * * ntpdate asia.pool.ntp.org >> /var/log/ntpdate.log
保存退出
这样就完成了你的系统到每天23:00去asia.pool.ntp.org 同步时间,并将同步的日志放到
/var/log/ntpdate.log

\

\

\

/

\

End