diff options
author | Christian Hesse <mail@eworm.de> | 2022-06-08 21:20:10 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-06-10 11:22:46 +0200 |
commit | c7087ac4fe9d4cde0755b241ce5326ae5e11bb98 (patch) | |
tree | a8657fdf2c6a3e7054b3e1dfcb31e899415477f6 /rotate-ntp | |
parent | 782bbb2c90860e36bac9242f35bcae9f8c768f96 (diff) |
rotate-ntp: do not flood the log on weak connection
Diffstat (limited to 'rotate-ntp')
-rw-r--r-- | rotate-ntp | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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; |