zoukankan      html  css  js  c++  java
  • centos7使用ntp自动同步时间

    使用VMware虚拟机由于电脑关机时,虚拟机没关闭,导致虚拟机被挂起,再打开电脑继续运行虚拟机时,时间就变为上次关闭电脑的时间,导致虚拟机时间不对,下面使用ntp来处理时间同步问题

    1.安装ntp

     yum -y install ntp

    2.设置开机自启并启动ntp服务

    systemctl enable ntpd
    systemctl start ntpd

    3.使用命令同步时间

    ntpdate -u cn.pool.ntp.org

     4.使用crontab定时自动同步时间

    echo "*/20 * * * * /usr/sbin/ntpdate -u ntp1.aliyun.com >/dev/null &" >> /var/spool/cron/root

    5.常用的ntp服务器

    国内:

    cn.pool.ntp.org  中国开源免费NTP服务器
    ntp1.aliyun.com 阿里云NTP服务器
    ntp2.aliyun.com 阿里云NTP服务器
    time1.aliyun.com 阿里云NTP服务器
    time2.aliyun.com 阿里云NTP服务器

    国外:

    time1.apple.com 苹果NTP服务器
    time2.apple.com 苹果NTP服务器
    time3.apple.com 苹果NTP服务器
    time4.apple.com 苹果NTP服务器
    time5.apple.com 苹果NTP服务器
    time1.google.com 谷歌NTP服务器
    time2.google.com 谷歌NTP服务器
    time3.google.com 谷歌NTP服务器
    time4.google.com 谷歌NTP服务器
    pool.ntp.org 开源免费NTP服务器
    百流积聚,江河是也;文若化风,可以砾石。
  • 相关阅读:
    js中undefined,null,NaN的区别
    js中数字计算精度
    BestCoder Round #32
    POJ 2299 求逆序对(归并排序或树状数组)
    POJ 2603
    CodeForces 515C
    POJ 1853 背包问题
    UVA 10115 子符串替换
    POJ 1155 树状dp
    HDU 2196 树状dp 求树中节点之间的最长距离
  • 原文地址:https://www.cnblogs.com/qixing/p/14295634.html
Copyright © 2011-2022 走看看