aboutsummaryrefslogtreecommitdiffstats
path: root/lease-script.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'lease-script.rsc')
-rw-r--r--lease-script.rsc16
1 files changed, 11 insertions, 5 deletions
diff --git a/lease-script.rsc b/lease-script.rsc
index f484414..bf27fda 100644
--- a/lease-script.rsc
+++ b/lease-script.rsc
@@ -1,16 +1,17 @@
#!rsc by RouterOS
# RouterOS script: lease-script
-# Copyright (c) 2013-2024 Christian Hesse <mail@eworm.de>
-# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
+# Copyright (c) 2013-2025 Christian Hesse <mail@eworm.de>
+# https://rsc.eworm.de/COPYING.md
#
-# requires RouterOS, version=7.14
+# requires RouterOS, version=7.15
#
# run scripts on DHCP lease
-# https://git.eworm.de/cgit/routeros-scripts/about/doc/lease-script.md
+# https://rsc.eworm.de/doc/lease-script.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
+:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
@@ -25,6 +26,7 @@
[ :typeof $leaseServerName ] = "nothing" || \
[ :typeof $leaseBound ] = "nothing") do={
$LogPrint error $ScriptName ("This script is supposed to run from ip dhcp-server.");
+ :set ExitOK true;
:error false;
}
@@ -32,11 +34,13 @@
"de" "" ] . "assigned lease " . $leaseActIP . " to " . $leaseActMAC);
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
+ :set ExitOK true;
:error false;
}
:if ([ :len [ /system/script/job/find where script=$ScriptName ] ] > 1) do={
$LogPrint debug $ScriptName ("More invocations are waiting, exiting early.");
+ :set ExitOK true;
:error true;
}
@@ -56,4 +60,6 @@
$LogPrint warning $ScriptName ("Running script '" . $Script . "' failed!");
}
}
-} on-error={ }
+} on-error={
+ :global ExitError; $ExitError $ExitOK [ :jobname ];
+}