mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04: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:
parent
5f2bc87b22
commit
9c9fb46e4a
1 changed files with 7 additions and 5 deletions
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={
|
||||
:local ScriptName [ / system script get $Script name ];
|
||||
:do {
|
||||
$LogPrintExit2 debug $0 ("Running script: " . $ScriptName) false;
|
||||
/ system script run $Script;
|
||||
} on-error={
|
||||
$LogPrintExit2 warning $0 ("Running script '" . $ScriptName . "' failed!") false;
|
||||
:if ([ :len [ / system script job find where script=$ScriptName ] ] < 2) do={
|
||||
:do {
|
||||
$LogPrintExit2 debug $0 ("Running script: " . $ScriptName) false;
|
||||
/ system script run $Script;
|
||||
} on-error={
|
||||
$LogPrintExit2 warning $0 ("Running script '" . $ScriptName . "' failed!") false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue