mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
lease-script: do not run too many instances of scripts
Every instance of the scripts does all the work. If one script is running and a second script is waiting we do not have to start a third one.
This commit is contained in:
12
lease-script
12
lease-script
@@ -27,10 +27,12 @@ $LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \
|
|||||||
|
|
||||||
:foreach Script in=[ / system script find where source~("\n# provides: lease-script " . $State . "\n") ] do={
|
:foreach Script in=[ / system script find where source~("\n# provides: lease-script " . $State . "\n") ] do={
|
||||||
:local ScriptName [ / system script get $Script name ];
|
:local ScriptName [ / system script get $Script name ];
|
||||||
:do {
|
:if ([ :len [ / system script job find where script=$ScriptName ] ] < 2) do={
|
||||||
$LogPrintExit2 debug $0 ("Running script: " . $ScriptName) false;
|
:do {
|
||||||
/ system script run $Script;
|
$LogPrintExit2 debug $0 ("Running script: " . $ScriptName) false;
|
||||||
} on-error={
|
/ system script run $Script;
|
||||||
$LogPrintExit2 warning $0 ("Running script '" . $ScriptName . "' failed!") false;
|
} on-error={
|
||||||
|
$LogPrintExit2 warning $0 ("Running script '" . $ScriptName . "' failed!") false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user