aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-02-21 18:35:08 +0100
committerGravatar Christian Hesse <mail@eworm.de>2019-02-21 18:35:08 +0100
commitfe1d234025f356f46b0e8b85de8b96193c0e95b5 (patch)
treefd77d79a5d77ac7173bcf9bbb6fce434c72334e8 /global-functions
parent4c28e9f9c2c2eea1c3f8a45fd694d62a3e0d3e75 (diff)
global-functions: add $ScriptLock
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions10
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."
+ }
+}