mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
rotate-ntp: do not flood the log on weak connection
This commit is contained in:
@ -11,6 +11,7 @@
|
|||||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||||
|
|
||||||
:global NtpPool;
|
:global NtpPool;
|
||||||
|
:global RotateNtpResolveFailed;
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
|
|
||||||
@ -24,8 +25,14 @@
|
|||||||
:do {
|
:do {
|
||||||
:set Ntp1 [ :resolve ("0." . $NtpPool) ];
|
:set Ntp1 [ :resolve ("0." . $NtpPool) ];
|
||||||
:set Ntp2 [ :resolve ("1." . $NtpPool) ];
|
:set Ntp2 [ :resolve ("1." . $NtpPool) ];
|
||||||
|
:set RotateNtpResolveFailed false;
|
||||||
} on-error={
|
} on-error={
|
||||||
$LogPrintExit2 warning $0 ("Resolving NTP server failed.") true;
|
:if ($RotateNtpResolveFailed != true) do={
|
||||||
|
:set RotateNtpResolveFailed true;
|
||||||
|
$LogPrintExit2 warning $0 ("Resolving NTP server failed.") true;
|
||||||
|
} else={
|
||||||
|
$LogPrintExit2 debug $0 ("Resolving NTP server failed.") true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$LogPrintExit2 info $0 ("Updating NTP servers to " . $Ntp1 . " and " . $Ntp2) false;
|
$LogPrintExit2 info $0 ("Updating NTP servers to " . $Ntp1 . " and " . $Ntp2) false;
|
||||||
|
Reference in New Issue
Block a user