aboutsummaryrefslogtreecommitdiff
path: root/lock
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-04-07 17:33:52 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-04-07 17:33:52 -0400
commita76371cf30bfd945b75b81a77a02a26a67b7478c (patch)
tree2e4010891d146e75a740b58553f365e4aaeca806 /lock
lock, a simple lock utility
Diffstat (limited to 'lock')
-rwxr-xr-xlock14
1 files changed, 14 insertions, 0 deletions
diff --git a/lock b/lock
new file mode 100755
index 0000000..b4b285d
--- /dev/null
+++ b/lock
@@ -0,0 +1,14 @@
+lock() {
+
+ if ! mkdir "$1" &>/dev/null; then
+ while true; do
+ sleep 2;
+ if [[ ! -d "$1" ]]; then
+ return
+ fi
+ done
+ fi;
+
+}
+
+lock $1