aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-06-08 21:20:10 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-06-10 11:22:46 +0200
commitc7087ac4fe9d4cde0755b241ce5326ae5e11bb98 (patch)
treea8657fdf2c6a3e7054b3e1dfcb31e899415477f6
parent782bbb2c90860e36bac9242f35bcae9f8c768f96 (diff)
rotate-ntp: do not flood the log on weak connection
-rw-r--r--rotate-ntp9
1 files changed, 8 insertions, 1 deletions
diff --git a/rotate-ntp b/rotate-ntp
index 2a095f8..73b9d8a 100644
--- a/rotate-ntp
+++ b/rotate-ntp
@@ -11,6 +11,7 @@
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:global NtpPool;
+:global RotateNtpResolveFailed;
:global LogPrintExit2;
@@ -24,8 +25,14 @@
:do {
:set Ntp1 [ :resolve ("0." . $NtpPool) ];
:set Ntp2 [ :resolve ("1." . $NtpPool) ];
+ :set RotateNtpResolveFailed false;
} 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;