aboutsummaryrefslogtreecommitdiffstats
path: root/lease-script.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'lease-script.rsc')
-rw-r--r--lease-script.rsc18
1 files changed, 9 insertions, 9 deletions
diff --git a/lease-script.rsc b/lease-script.rsc
index bf27fda..ab44956 100644
--- a/lease-script.rsc
+++ b/lease-script.rsc
@@ -8,11 +8,11 @@
# run scripts on DHCP lease
# https://rsc.eworm.de/doc/lease-script.md
-:global GlobalFunctionsReady;
-:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
-
:local ExitOK false;
-:do {
+: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 Grep;
@@ -53,13 +53,13 @@
}
:foreach Order,Script in=$RunOrder do={
- :do {
+ :onerror Err {
$LogPrint debug $ScriptName ("Running script with order " . $Order . ": " . $Script);
/system/script/run $Script;
- } on-error={
- $LogPrint warning $ScriptName ("Running script '" . $Script . "' failed!");
+ } do={
+ $LogPrint warning $ScriptName ("Running script '" . $Script . "' failed: " . $Err);
}
}
-} on-error={
- :global ExitError; $ExitError $ExitOK [ :jobname ];
+} do={
+ :global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
}