hotspot-to-wpa-cleanup: drop main function, use :do with on-error

This commit is contained in:
Christian Hesse 2024-03-06 15:28:55 +01:00
parent 47b67af226
commit b622f47d65
3 changed files with 12 additions and 18 deletions

View file

@ -14,8 +14,8 @@
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local Main do={
:local ScriptName [ :tostr $1 ];
:do {
:local ScriptName [ :jobname ];
:global EitherOr;
:global LogPrintExit2;
@ -23,7 +23,7 @@
:global ScriptLock;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
:error false;
}
:local DHCPServers ({});
@ -71,6 +71,4 @@
/ip/dhcp-server/lease/remove $Lease;
}
}
}
$Main [ :jobname ];
} on-error={ }

View file

@ -15,8 +15,8 @@
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local Main do={
:local ScriptName [ :tostr $1 ];
:do {
:local ScriptName [ :jobname ];
:global EitherOr;
:global LogPrintExit2;
@ -24,7 +24,7 @@
:global ScriptLock;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
:error false;
}
:local DHCPServers ({});
@ -78,6 +78,4 @@
/ip/dhcp-server/lease/remove $Lease;
}
}
}
$Main [ :jobname ];
} on-error={ }

View file

@ -14,8 +14,8 @@
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:local Main do={
:local ScriptName [ :tostr $1 ];
:do {
:local ScriptName [ :jobname ];
:global EitherOr;
:global LogPrintExit2;
@ -23,7 +23,7 @@
:global ScriptLock;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
:error false;
}
:local DHCPServers ({});
@ -71,6 +71,4 @@
/ip/dhcp-server/lease/remove $Lease;
}
}
}
$Main [ :jobname ];
} on-error={ }