[Linux][CentOS]同步网络时间

1. 查看系统时间:【date】

2.查看系统硬件时间:【hwclock】, 设置:【hwclock -w】

3.同步网络时间:软件【ntpdate】如没有安装,请yum install -y ntpdate

步骤:

1.#ntpdate time.nuri.net  同步网络时间

返回:step time server 36.3.117.150 offset 273908944.512694 sec

可选的服务器有:

time.nuri.net,0.asia.pool.ntp.org,1.asia.pool.ntp.org,2.asia.pool.ntp.org

,3.asia.pool.ntp.org

2.#hwclock -w 同步时间成功后调整硬件时间

3. #date  #hwclock 查看时间是否设置成功

执行上述命令,显示的时间应该一样的

4.定时执行时间同步任务,利用crontab -e 添加定时任务

#* */1 * * * root ntpdatetime.nuri.net;hwclock -w 

即:每隔一个小时同步一下internet时间。

你可能感兴趣的:([Linux][CentOS]同步网络时间)