问题现象:ntp进程运行一段时间后自动退出
排查过程:
查看/var/log/message ntp异常信息如下
Feb 20 22:54:41 xnu_1 ntpd[2187]: 0.0.0.0 0617 07 panic_stop -28777 s; set clock manually within 1000 s.
Feb 20 22:54:57 xnu_1 ntpd_intres[2193]: parent died before we finished, exiting
查看官方文档,有如下说明:
-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 threshold 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. See the tinker command for other options.
大意就是,默认情况下如果ntp本地时间与上级ntp时间差超过1000s,那么ntp进程就会退出并在系统日志文件中记录。
可以使用tinker命令调整该阈值:
tinker [allan allan | dispersion dispersion | freq freq | huffpuff
huffpuff | panic panic | step srep | stepout stepout]
This command can be used to alter several system variables in
very exceptional circumstances. It should occur in the configu-
ration file before any other configuration options. The default
values of these variables have been carefully optimized for a
wide range of network speeds and reliability expectations. In
general, they interact in intricate ways that are hard to predict
and some combinations can result in some very nasty behavior.
Very rarely is it necessary to change the default values; but,
some folks cannot resist twisting the knobs anyway and this com-
mand is for them. Emphasis added: twisters are on their own and
can expect no help from the support group.
The variables operate as follows:
panic panic
The argument is the panic threshold, normally 1000 s. If