mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
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.
This commit is contained in:
parent
e7d9a94ad8
commit
6469825398
1 changed files with 13 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue