Linux 时间同步ntpdate

版权声明:Boomlee https://blog.csdn.net/BoomLee/article/details/82767171

1.应用场景

 Linux网络时间同步

2.解决办法

 2.1安装ntpdate 完成时间同步

# yum install ntpdate -y

 2.2手工同步网络时间,执行以下命令,将从time.nist.gov同步时间

# ntpdate 0.asia.pool.ntp.org

若上面的时间服务器不可用,也可以选择以下服务器同步时间

  time.nist.gov

  time.nuri.net

  0.asia.pool.ntp.org

  1.asia.pool.ntp.org

  2.asia.pool.ntp.org

  3.asia.pool.ntp.org

2.3系统时间同步到硬件,防止系统重启后时间被还原

# hwclock --systohc

2.4定时执行时间同步任务,crontab -e  命令来添加定时任务

*/10 * * * * /usr/sbin/ntpdate time.nist.gov

每隔10分钟一次执行时间同步

猜你喜欢

转载自blog.csdn.net/BoomLee/article/details/82767171