mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-25 02:58:37 +02:00
global-functions: add $ScriptLock
This commit is contained in:
parent
4c28e9f9c2
commit
fe1d234025
1 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue