免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1860 | 回复: 2
打印 上一主题 下一主题

[日期时间] NTP不能用怎么办,请用我写的脚本来同步时间,不需要用ntp同步时间 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-09-30 08:54 |显示全部楼层 |倒序浏览
本帖最后由 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
复制代码

论坛徽章:
0
2 [报告]
发表于 2012-10-17 22:59 |显示全部楼层
回复 4# rdcwayx

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

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

   

论坛徽章:
0
3 [报告]
发表于 2012-10-17 23:00 |显示全部楼层
1. 期间不能使用有1个多月,并不是5分钟
2. 防火墙是关闭的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP