mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-14 15:09:02 +02:00
dhcp-lease-comment: drop main function, use :do with on-error
This commit is contained in:
parent
f79206a9b8
commit
0d1c4cece2
4 changed files with 16 additions and 24 deletions
|
@ -14,14 +14,14 @@
|
||||||
:global GlobalFunctionsReady;
|
:global GlobalFunctionsReady;
|
||||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||||
|
|
||||||
:local Main do={
|
:do {
|
||||||
:local ScriptName [ :tostr $1 ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:return false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
||||||
|
@ -36,6 +36,4 @@
|
||||||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} on-error={ }
|
||||||
|
|
||||||
$Main [ :jobname ];
|
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
:global GlobalFunctionsReady;
|
:global GlobalFunctionsReady;
|
||||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||||
|
|
||||||
:local Main do={
|
:do {
|
||||||
:local ScriptName [ :tostr $1 ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:return false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
||||||
|
@ -36,6 +36,4 @@
|
||||||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} on-error={ }
|
||||||
|
|
||||||
$Main [ :jobname ];
|
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
:global GlobalFunctionsReady;
|
:global GlobalFunctionsReady;
|
||||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||||
|
|
||||||
:local Main do={
|
:do {
|
||||||
:local ScriptName [ :tostr $1 ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:return false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
||||||
|
@ -41,6 +41,4 @@
|
||||||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} on-error={ }
|
||||||
|
|
||||||
$Main [ :jobname ];
|
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
:global GlobalFunctionsReady;
|
:global GlobalFunctionsReady;
|
||||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||||
|
|
||||||
:local Main do={
|
:do {
|
||||||
:local ScriptName [ :tostr $1 ];
|
:local ScriptName [ :jobname ];
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:return false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
|
||||||
|
@ -36,6 +36,4 @@
|
||||||
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
/ip/dhcp-server/lease/set comment=$NewComment $Lease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} on-error={ }
|
||||||
|
|
||||||
$Main [ :jobname ];
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue