exit-post-hook-unlock.sh: exit gracefully if LOCKDIR does not exist
[experiments/hook-lock.git] / exit-post-hook-unlock.sh
index d618346..02d3648 100755 (executable)
@@ -14,6 +14,8 @@
 set -e
 
 LOCKDIR=/run/lock/mylockdir
 set -e
 
 LOCKDIR=/run/lock/mylockdir
+[ -d "$LOCKDIR" ] || exit 0
+
 LOCKPID=$(cat "$LOCKDIR/pid")
 [ "$LOCKPID" = $PPID ] || { echo "The enter script was launched from another process. Unlocking aborted." >&2; exit 1; }
 
 LOCKPID=$(cat "$LOCKDIR/pid")
 [ "$LOCKPID" = $PPID ] || { echo "The enter script was launched from another process. Unlocking aborted." >&2; exit 1; }