diff options
author | Christian Hesse <mail@eworm.de> | 2023-06-22 14:21:52 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-06-22 22:45:32 +0200 |
commit | 64698253983f4ea608b31eb46fb4ac11fc9a156c (patch) | |
tree | da67a9e69749888944c912f051474bceba37ec1b /global-functions.rsc | |
parent | e7d9a94ad8ec93cd67111a7c6b912124f95d8c00 (diff) |
global-functions: $IsTimeSync: reset ntp client when "waiting"
Every now and then the ntp client stays in status "waiting" forever...
This happens if the server answers, but is not accurate enough. Unlike
with connection failure the address is not rotated. (SUP-120012)
Let's reset it... Should help with a pool address (like pool.ntp.org)
at least.
Diffstat (limited to 'global-functions.rsc')
-rw-r--r-- | global-functions.rsc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/global-functions.rsc b/global-functions.rsc index 98f6978..bdab5a2 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -504,6 +504,7 @@ # check if system time is sync :set IsTimeSync do={ :global IsTimeSyncCached; + :global IsTimeSyncResetNtp; :global LogPrintExit2; @@ -516,6 +517,18 @@ :set IsTimeSyncCached true; :return true; } + + :if ([ /system/resource/get uptime ] < 3m || $IsTimeSyncResetNtp = true) do={ + :return false; + } + + :set IsTimeSyncResetNtp true; + /system/ntp/client/set enabled=no; + :delay 20ms; + /system/ntp/client/set enabled=yes; + /system/scheduler/add name="clear-IsTimeSyncResetNtp" interval=1m \ + on-event=("/system/scheduler/remove clear-IsTimeSyncResetNtp; " . \ + ":global IsTimeSyncResetNtp; :set IsTimeSyncResetNtp;"); :return false; } |