diff options
author | Christian Hesse <mail@eworm.de> | 2020-05-15 20:10:24 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-05-15 20:15:20 +0200 |
commit | 56b6da71c3d30ae3961f1251afcbb5617dae17a3 (patch) | |
tree | 7686a3b4c31d638d2a1460a233170c049de36419 | |
parent | 12a29d076f4de3e8a254b6306d53cf717ca6ff48 (diff) |
rotate-ntp: log resolve errors
-rw-r--r-- | rotate-ntp | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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; |