aboutsummaryrefslogtreecommitdiffstats
path: root/rotate-ntp
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-05-15 20:10:24 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-05-15 20:15:20 +0200
commit56b6da71c3d30ae3961f1251afcbb5617dae17a3 (patch)
tree7686a3b4c31d638d2a1460a233170c049de36419 /rotate-ntp
parent12a29d076f4de3e8a254b6306d53cf717ca6ff48 (diff)
rotate-ntp: log resolve errors
Diffstat (limited to 'rotate-ntp')
-rw-r--r--rotate-ntp11
1 files changed, 9 insertions, 2 deletions
diff --git a/rotate-ntp b/rotate-ntp
index e0c1999..22eca07 100644
--- a/rotate-ntp
+++ b/rotate-ntp
@@ -9,12 +9,19 @@
:global LogPrintExit;
-:local Ntp1 [ :resolve ("0." . $NtpPool) ];
-:local Ntp2 [ :resolve ("1." . $NtpPool) ];
+:local Ntp1;
+:local Ntp2;
:if ([ / system ntp client get enabled ] != true) do={
$LogPrintExit warning "NTP client is not enabled!" true;
}
+:do {
+ :set Ntp1 [ :resolve ("0." . $NtpPool) ];
+ :set Ntp2 [ :resolve ("1." . $NtpPool) ];
+} on-error={
+ $LogPrintExit warning "Resolving NTP server failed." true;
+}
+
$LogPrintExit info ("Updating NTP servers to " . $Ntp1 . " and " . $Ntp2) false;
/ system ntp client set primary-ntp=$Ntp1 secondary-ntp=$Ntp2;