aboutsummaryrefslogtreecommitdiffstats
path: root/rotate-ntp
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-02-22 15:14:10 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-02-24 21:51:54 +0100
commitf46db918453dcb8878b9a0de6e122fb0ea2224d9 (patch)
tree31544a450651d0705ecdea0c3d35e650ef784d67 /rotate-ntp
parentb0e52aa2d1baa78fc9d025c0671fea8babba0ec2 (diff)
global: give script or function name in log messages
Diffstat (limited to 'rotate-ntp')
-rw-r--r--rotate-ntp9
1 files changed, 5 insertions, 4 deletions
diff --git a/rotate-ntp b/rotate-ntp
index 6578078..24eb107 100644
--- a/rotate-ntp
+++ b/rotate-ntp
@@ -6,26 +6,27 @@
# rotate the ntp servers
# https://git.eworm.de/cgit/routeros-scripts/about/doc/rotate-ntp.md
+:local 0 "rotate-ntp";
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:global NtpPool;
-:global LogPrintExit;
+:global LogPrintExit2;
:local Ntp1;
:local Ntp2;
:if ([ / system ntp client get enabled ] != true) do={
- $LogPrintExit warning "NTP client is not enabled!" true;
+ $LogPrintExit2 warning $0 ("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;
+ $LogPrintExit2 warning $0 ("Resolving NTP server failed.") true;
}
-$LogPrintExit info ("Updating NTP servers to " . $Ntp1 . " and " . $Ntp2) false;
+$LogPrintExit2 info $0 ("Updating NTP servers to " . $Ntp1 . " and " . $Ntp2) false;
/ system ntp client set primary-ntp=$Ntp1 secondary-ntp=$Ntp2;