Chinaunix

标题: NTP不能用怎么办,请用我写的脚本来同步时间,不需要用ntp同步时间 [打印本页]

作者: gudai    时间: 2012-09-30 08:54
标题: NTP不能用怎么办,请用我写的脚本来同步时间,不需要用ntp同步时间
本帖最后由 gudai 于 2012-09-30 08:58 编辑

NTP实在无法搞定,这台是x64的机器,也不知道是为什么,各种办法用尽。。。NTP依旧报 no server suitable for synchronization found错误
  1. [root@localhost conf]# /usr/sbin/ntpdate 210.72.145.44
  2. 14 Oct 09:40:38 ntpdate[29901]: no server suitable for synchronization found
复制代码
因为我实在搞不定NTP,本地架设了NTP服务器依然不行!!!浪费了太多时间。

只好写了如下脚本解决此问题。
  1. wget http://shushu.com.cn/tm.php -O date.txt
  2. ntptm=`cat date.txt | awk '{print $1}'`
  3. date -s $ntptm
复制代码
将此脚本加入cron就不需要用ntp同步时间了
  1. crontab -e
  2. 59 22 *  *  * /root/ShellNTP.sh
复制代码

作者: w630866139    时间: 2012-09-30 20:00
Waiting at least 5 minutes after starting ntp server
作者: dn833    时间: 2012-09-30 22:13
  1. ntpdate 133.100.11.8
复制代码

作者: rdcwayx    时间: 2012-10-01 19:42
本帖最后由 rdcwayx 于 2012-10-01 21:43 编辑
  1. date -s `wget -qO- http://shushu.com.cn/tm.php  |awk '{print $1}'  `
复制代码

作者: w630866139    时间: 2012-10-01 21:32
have you turned off the firewall?
作者: gudai    时间: 2012-10-17 22:59
回复 4# rdcwayx

你这个最后一个符号太隐蔽了

date -s `wget -qO- http://shushu.com.cn/tm.php  |awk '{print $1}'`

   
作者: gudai    时间: 2012-10-17 23:00
1. 期间不能使用有1个多月,并不是5分钟
2. 防火墙是关闭的




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2