global-functions: add $ScriptLock

This commit is contained in:
Christian Hesse 2019-02-21 18:35:08 +01:00
parent 4c28e9f9c2
commit fe1d234025

View file

@ -187,3 +187,13 @@
: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."
}
}