diff options
author | Christian Hesse <mail@eworm.de> | 2024-03-06 23:53:50 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-03-12 15:27:15 +0100 |
commit | 6fd39bd3c5d7c3fe5dca9e92275f60e0b3217f03 (patch) | |
tree | 7ced2fbdb536447b537a967e945600ba6dd78c8a /lease-script.rsc | |
parent | b86d6314868596dacdf422db80ef0ff27c61c644 (diff) | |
parent | f0856c264e07804a229668268a457f2154cb373a (diff) |
Merge branch 'do-with-on-error' into nextrouteros-7.15beta4-2
Diffstat (limited to 'lease-script.rsc')
-rw-r--r-- | lease-script.rsc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lease-script.rsc b/lease-script.rsc index 582f8ff..0f6b7f8 100644 --- a/lease-script.rsc +++ b/lease-script.rsc @@ -11,12 +11,8 @@ :global GlobalFunctionsReady; :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } -:local Main do={ - :local ScriptName [ :tostr $1 ]; - :local leaseActIP [ :tostr $2 ]; - :local leaseActMAC [ :tostr $2 ]; - :local leaseServerName [ :tostr $2 ]; - :local leaseBound [ :tostr $2 ]; +:do { + :local ScriptName [ :jobname ]; :global Grep; :global IfThenElse; @@ -35,12 +31,12 @@ "de" "" ] . "assigned lease " . $leaseActIP . " to " . $leaseActMAC) false; :if ([ $ScriptLock $ScriptName 10 ] = false) do={ - :return false; + :error false; } :if ([ :len [ /system/script/job/find where script=$ScriptName ] ] > 1) do={ $LogPrintExit2 debug $ScriptName ("More invocations are waiting, exiting early.") false; - :return true; + :error true; } :local RunOrder ({}); @@ -59,6 +55,4 @@ $LogPrintExit2 warning $ScriptName ("Running script '" . $Script . "' failed!") false; } } -} - -$Main [ :jobname ] $leaseActIP $leaseActMAC $leaseServerName $leaseBound; +} on-error={ } |