服务器时间同步

来源:互联网 发布:程序员做生意 编辑:程序博客网 时间:2024/04/30 09:45

1.让服务器的时间同步,寻找一个网络时间服务器,比如一些国家的授时中心

  微软公司授时主机(美国)
  time.windows.com
  台警大授时中心(台湾)
  asia.pool.ntp.org
  新加坡授时中心
  203.117.180.36
2.我们的电脑怎样去同步授时中心的时间
  ntpdate asia.pool.ntp.org
  或者使用rdate命令
    -p  显示远端主机的日期与时间。 
    -s  把从远端主机收到的日期和时间,回存到本地主机的系统时间
  rdate -s 203.117.180.36
  上面此命令就是去同步授时中心的时间
  如果要让系统每天23:00去同步,这样可以使用上面所将的crontab设置计划同步
  如下命令
  #crontab -e
  进入crontab编辑模式,使用方法同vi
  输入 0 23 * * * ntpdate asia.pool.ntp.org >> /var/log/ntpdate.log
  或者
  输入 00 23 * * * /bin/bash rdate -s 203.117.180.36
  保存退出
  这样就完成了你的系统到每天23:00去asia.pool.ntp.org 同步时间,并将同步的日志放到
  /var/log/ntpdate.log
原创粉丝点击