
Estoy usando ntpdate para actualizar la hora. Si no hay conexión a Internet o el servidor NTP no funciona, ntpdate falla, pero tarda mucho en salir (aproximadamente de 20 a 23 segundos). Leí el manual de ntpdate y veo la opción -t timeout.
-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.
Pensé en probar esta opción pero me está tomando el mismo tiempo salir. Pensé que si especificamos el tiempo de espera, ntpdate saldrá en los segundos especificados. Usé el comando así
ntpdate -u -t 10 <ip>
¿Alguien probó la opción de tiempo de espera en ntpdate?
Respuesta1
- ntpdate intercambiará información con el servidor ntp al menos tres veces, antes de configurar el tiempo para que el cliente confíe en este servidor ntp.
- Por lo tanto, si agrega
-t 10
la opción en ntpdate, es posible que se ejecute durante unos 30 segundos. - Puede agregar
-d
la opción para obtener más información sobre cómo verificar con el servidor ntp.# ntpdate -dv -4 time.stdtime.gov.tw 16 Jul 14:57:36 ntpdate[652]: ntpdate [email protected] Wed Jun 22 03:15:52 UTC 2022 (1) Looking for host time.stdtime.gov.tw and service ntp 118.163.81.61 reversed to 118-163-81-61.hinet-ip.hinet.net host found : 118-163-81-61.hinet-ip.hinet.net transmit(118.163.81.61) // first time receive(118.163.81.61) transmit(118.163.81.61) // second time receive(118.163.81.61) transmit(118.163.81.61) // third time receive(118.163.81.61) transmit(118.163.81.61) // fourth time receive(118.163.81.61) server 118.163.81.61, port 123 stratum 2, precision -25, leap 00, trust 000 refid [192.168.0.3], root delay 0.000397, root dispersion 0.019592 reference time: e67cdd88.16fefc9c Sat, Jul 16 2022 14:47:36.089 originate timestamp: e67cdfe7.80de2e29 Sat, Jul 16 2022 14:57:43.503 transmit timestamp: e67cdfe7.5e43017f Sat, Jul 16 2022 14:57:43.368 filter delay: 0.29337 0.31583 0.28447 0.31200 ---- ---- ---- ---- filter offset: -0.003258 -0.024422 -0.004762 -0.008031 ---- ---- ---- ---- delay 0.28447, dispersion 0.00401, offset -0.004762 16 Jul 14:57:43 ntpdate[652]: adjust time server 118.163.81.61 offset -0.004762 sec