CentOS服务器时间同步

chenyajun  2020-02-02 11:02:12  阅读 3078 次 评论 0 条

查看服务器里的时间设置  timedatectl ,它等同于  timedatectl status

如果你使用的是linux系统,可以使用命令ntpdate来同步时间

如果系统没有ntpdate命令,可以安装一下NTP:

yum install ntp

安装完了之后,你就可以进行时间同步操作了:

ntpdate asia.pool.ntp.org

如果出去类似下面的内容,那说明同步成功了

3 Nov 10:11:56 ntpdate[3418]: adjust time server 128.138.141.172 offset 0.005211 sec

7 Nov 18:38:30 ntpdate[58169]: step time server 129.250.35.251 offset -835.726304 sec

当然你也可以把这个写到crontab里,这样一来,服务器就能定时自动同步时间了:

*/15 * * * * ntpdate time.nist.gov

每隔十五分钟同步一次

下边推荐几个时间服务器:

time.nist.gov

time.nuri.net

asia.pool.ntp.org

asia.pool.ntp.org

asia.pool.ntp.org

asia.pool.ntp.org

本文地址:http://www.chenyajun.net/index.php/post/57.html
版权声明:本文为原创文章,版权归 chenyajun 所有,欢迎分享本文,转载请保留出处!

评论已关闭!