美文网首页
Centos 7 同步网络时间

Centos 7 同步网络时间

作者: 萧萧飞叶 | 来源:发表于2019-03-13 22:24 被阅读0次
  1. date命令:
    $ date :显示系统时间

  2. hwclock命令 (即hardwareclock系统硬件时间)
    $ hwclock :显示硬件时间
    $ hwclock -w :将系统时间写入到系统硬件当中

  3. ntpdate命令
    ntpdate 是一个linux时间同步服务软件
    $ yum install -y ntpdate
    $ ntpdate 0.asia.pool.ntp.org :同步网络时间

3 Jun 15:42:39 ntpdate[4721]: adjust time server 211.115.194.21 offset -0.005885 sec

出现上述结果代表时间同步成功,上面的大致意思为调整时间为服务器211.115.194.21的时间,相差-0.005885秒的时间
如果上面time.nist.gov服务器同步不了,可以换下面几个时间服务器试试:

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

同步时间成功后调整硬件时间:$ hwclock -w
执行成功后, 查看系统硬件时间,现在date和hwclock现实的时间均为internet时间

$ date $ hwclock执行两个命令,显示的时间应该一样的

  1. 定时执行时间同步
    crontab 命令
    $ vi /etc/crontab
30 4 * * * root ntpdate 0.asia.pool.ntp.org && hwclock -w

每天 4:30:00 执行一次时间同步

相关文章

  • Centos 7 同步网络时间

    date命令:$ date :显示系统时间 hwclock命令 (即hardwareclock系统硬件时间)$ h...

  • centos 7 时间同步

    平时没注意虚拟机上centos的时间,今天date一下,发现时间不对 虽然是设置了CST的时间,时区也是重庆上海,...

  • centos系统同步 网络时间

    使用阿里云oss上传文件配置文件报错如下: 可以看到提示时间不一致,此时查看centos服务器时间确实和网络时间不...

  • Hadoop 集群搭建

    集群搭建 说明:基于centos 64位 1.同步时间 手动同步: 网络同步时间: 设置时区: 2.设置主机名 3...

  • 20170822 网络管理(三)

    CentOS 7网卡命名CentOS 7主机名CentOS 7网络配置工具CentOS 7网络组CentOS 7网...

  • Centos7 时间同步

    首先要能访问Google,否则下面的脚本执行会出问题,造成错误的时间校对以下操作需要在root账户下进行

  • CentOS 7同步系统时间

    使用ntpdate工具同步系统时间,并借助crontab定时任务来自动做日期同步的操作,以达到系统时间自动维护的目...

  • centos7 同步时间

  • linux

    CentOS 7 时区、日期时间查看以及设置杂烩 CentOS 7 中时区、日期时间的查看、设置。包括网络时间协议...

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

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

网友评论

      本文标题:Centos 7 同步网络时间

      本文链接:https://www.haomeiwen.com/subject/ypuxmqtx.html