首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我如何制作一个木偶模块来修正时间?

我如何制作一个木偶模块来修正时间?
EN

Unix & Linux用户
提问于 2013-09-19 21:10:17
回答 1查看 852关注 0票数 0

我已经编写了一个木偶模块,它通过NTP校正时间,但这只能在服务器上使用一个小的NTP偏移量。

由于各种原因,有时服务器的时间偏移超过10分钟。

当ntp偏移量太高时,我想创建一个运行exec "service ntpd stop;ntpdate ntp3.domain.local;service ntpd start“的木偶模块,以强制更正时间。

如何查看NTP偏移量是否过高,以便告诉Puppet运行此命令?还是有更好的解决方案?

EN

回答 1

Unix & Linux用户

发布于 2013-09-19 21:42:05

服务ntpd停止;ntpdate ntp3.domain.local;服务ntpd启动

绝对是解决这个问题的错误方法。对-g使用ntpd选项:

代码语言:javascript
复制
   -g     Normally, ntpd exits with a message to the  system  log  if  the
          offset  exceeds the panic threshold, which is 1000 s by default.
          This option allows the time to  be  set  to  any  value  without
          restriction; however, this can happen only once.  If the thresh‐
          old is exceeded after that, ntpd will exit with a message to the
          system log.  This option can be used with the -q and -x options.

将其与iburst选项结合起来,就像slm所建议的那样,因为如果没有这一点,就需要ntpd年龄来纠正这种巨大的差异。它通常只在很小的步骤中尝试更改系统时间,这样依赖于时间的应用程序就不会混淆,但是iburst选项会改变这一点。

您仍然需要确保木偶在恐慌之后自动重新启动ntpd,因为根据该命令,它将固定时间一次,然后它仍然会死掉。

票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/91477

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档