diff options
author | Christian Hesse <mail@eworm.de> | 2024-03-06 15:28:55 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-03-12 15:27:15 +0100 |
commit | 6546e7f085c9a5ce33c6efa0b1887d178eb4ac5a (patch) | |
tree | af67fffd104be9f882123be7cbe6b84c85013906 /lease-script.rsc | |
parent | 6f91c97b7fe68dbfd5274259aafbc2a77dd80d3d (diff) |
lease-script: drop main function, use :do with on-error
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={ } |