• VPS centos 5 系统启动自动同步以及定时任务同步系统日期时间


    vps系统启动完成自动同步系统日期时间:

    vi /etc/rc.local 
    然后在文件末尾加上:
    /usr/sbin/ntpdate ntp.fudan.edu.cn

    保存退出!

    相关详细配置

    新装的服务器可能设置了错误的,需要调整时区并调整时间.如下是使用NTP来从一个时间服务器同步

    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    ntpdate ntp.fudan.edu.cn

    很简单吧,解析一下,第一句是把当前时区调整为上海就是+8区,想改其他时区也可以去看看/usr/share/zoneinfo目录;

    然后第二句是利用ntpdate同步标准时间.

    没有安装ntpdate的可以yum一下:

    yum install -y ntpdate

    加入定时计划任务,每隔10分钟同步一下时钟

    crontab -e

    0-59/10 * * * * /usr/sbin/ntpdate ntp.fudan.edu.cn | logger -t NTP

    中国国家授时中心:
    http://www.time.ac.cn/stime.asp

    其他网络时间服务器地址如下:(也可以自己去搜索下)

    time.nist.gov (美国)
    ntp.fudan.edu.cn (复旦) )(国内用户推荐使用此服务器)
    timekeeper.isi.edu
    subitaneous.cpsc.ucalgary.ca
    usno.pa-x.dec.com
    time.twc.weather.com
    swisstime.ethz.ch
    ntp0.fau.de
    ntp3.fau.de
    time-a.nist.gov
    time-b.nist.gov
    time-nw.nist.gov
    nist1-sj.glassey.com

  • 相关阅读:
    Core Text 实现富文本显示
    音视频直播服务平台总结
    WWDC2017那些事
    Swift网络请求(Moya篇)
    [转贴]孙正耀退休感言
    不要让专业限制了你的高度
    你会搞科研吗?
    上传服务端
    AysnTask+HttpClient实现上传
    TextView改变颜色
  • 原文地址:https://www.cnblogs.com/jifeng/p/1903813.html
Copyright © 2020-2023  润新知