diff options
-rw-r--r-- | global-functions | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/global-functions b/global-functions index b22a295..533e588 100644 --- a/global-functions +++ b/global-functions @@ -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." + } +} |