aboutsummaryrefslogtreecommitdiffstats
path: root/ospf-to-leds.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'ospf-to-leds.rsc')
-rw-r--r--ospf-to-leds.rsc22
1 files changed, 13 insertions, 9 deletions
diff --git a/ospf-to-leds.rsc b/ospf-to-leds.rsc
index b78faa4..26f8aa3 100644
--- a/ospf-to-leds.rsc
+++ b/ospf-to-leds.rsc
@@ -1,17 +1,18 @@
#!rsc by RouterOS
# RouterOS script: ospf-to-leds
-# Copyright (c) 2020-2024 Christian Hesse <mail@eworm.de>
-# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
+# Copyright (c) 2020-2025 Christian Hesse <mail@eworm.de>
+# https://rsc.eworm.de/COPYING.md
#
-# requires RouterOS, version=7.14
+# requires RouterOS, version=7.15
#
# visualize ospf instance state via leds
-# https://git.eworm.de/cgit/routeros-scripts/about/doc/ospf-to-leds.md
+# https://rsc.eworm.de/doc/ospf-to-leds.md
-:global GlobalFunctionsReady;
-:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
-
-:do {
+:local ExitOK false;
+:onerror Err {
+ :global GlobalConfigReady; :global GlobalFunctionsReady;
+ :retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
+ do={ :error ("Global config and/or functions not ready."); }; } delay=500ms max=50;
:local ScriptName [ :jobname ];
:global LogPrint;
@@ -19,6 +20,7 @@
:global ScriptLock;
:if ([ $ScriptLock $ScriptName ] = false) do={
+ :set ExitOK true;
:error false;
}
@@ -42,4 +44,6 @@
/system/leds/set type=off [ find where leds=$LED ];
}
}
-} on-error={ }
+} do={
+ :global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
+}