linux使用ntpdate定时同步时间

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lianshaohua/article/details/84307858

linux操作系统同步时间的方案有很多,本小节主要讲通过crontab和ntpdate实现定时同步时间的功能:

1、首先安ntpdate:yum install ntpdate -y

2、安装完成以后,手动测试一下:sudo ntpdate 0.asia.pool.ntp.org

      如果同步成功后,则会显示时间的差异:

     有很多可以使用的时间同步服务器,列几个:

  0.asia.pool.ntp.org

  1.asia.pool.ntp.org

  2.asia.pool.ntp.org

  3.asia.pool.ntp.org

  time.nist.gov

  time.nuri.net

3、配置定时同步的功能:

    1、打开crontable配置文件:sudo vim /etc/crontab

    2、配置如下:

           

           (配置 为1小时同步一次时间)

猜你喜欢

转载自blog.csdn.net/lianshaohua/article/details/84307858