mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: add $ScriptLock
This commit is contained in:
parent
4c28e9f9c2
commit
fe1d234025
|
@ -187,3 +187,13 @@
|
||||||
|
|
||||||
:return true;
|
:return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# lock script against multiple invocation
|
||||||
|
:global ScriptLock do={
|
||||||
|
:local Script [ :tostr $1 ];
|
||||||
|
|
||||||
|
:if ([ / system script job print count-only where script=$Script ] > 1) do={
|
||||||
|
:log debug ("Script " . $Script . " started more than once... Aborting.");
|
||||||
|
:error "Locked."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue