我正在使用ntpdate更新时间。如果没有internet连接或NTP服务器关闭,ntpdate就会失败,但是ntpdate退出需要很长时间(大约20到23秒)。我阅读了ntpdate的手册,并看到了-t超时选项。
-t timeout Specify the maximum time waiting for a server response as the value timeout, in seconds and fraction. The value is rounded to a multiple of 0.2 seconds. The default is 1 second, a value suitable for polling across a LAN.
我想尝试这个选项,但退出需要同样的时间。我想,如果我们指定超时,那么ntpdate将在指定的秒内退出。我用了这样的命令
ntpdate -u -t 10 <ip>
有人尝试过ntpdate中的超时选项吗?
发布于 2022-07-16 07:05:38
-t 10选项,它可能会运行大约30多个。-d选项以获得有关使用ntp服务器进行检查的更多信息。# ntpdate -dv -4 time.stdtime.gov.tw 16 Jul 14:57:36 ntpdate652:ntpdate 4.2.8p15@1.3728-o Wed Jun 22 03:15:52 UTC 2022 (1)查找主机time.stdtime.gov.tw和服务ntp 118.163.81.61反向到118-163-81-61.hinet-ip.hinet.net主机发现: 118-163-81-61.hinet-ip.hinet.net发送(118.163.81.61)/第一次接收(118.163.81.61)发送(118.163.81.61) //第二次接收(118.163.81.61)发送(118.163.81.61) //第三次接收(118.163.81.61)发送(118.163.81.61) //第四次接收(118.163.81.61)服务器118.163.81.61,端口123层2,精度-25,leap 00,信任000 refid 192.168.0.3,根延迟0.000397,根色散0.019592参考时间: e67cdd88.16fefc9c Sat,Jul 16 2022 14:47:36.089起始时间戳: e67cdfe7.80de2e29 Sat,7月16日2022 14:57:43.503传输时间戳: e67cdfe7.5e43017f Sat,7月16日2022年14:57:43.368滤波器延迟: 0.29337 0.31583 0.28447 0.31200偏移量-0.004762 7月16日14:57:43 ntpdate652:调整时间服务器118.163.81.61偏移-0.004762秒https://serverfault.com/questions/1070511
复制相似问题