projects
/
experiments
/
hook-lock.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6e3f2c8
)
exit-post-hook-unlock.sh: exit gracefully if LOCKDIR does not exist
author
Antonio Ospite <ao2@ao2.it>
Tue, 8 May 2018 15:46:34 +0000
(17:46 +0200)
committer
Antonio Ospite <ao2@ao2.it>
Tue, 8 May 2018 15:46:34 +0000
(17:46 +0200)
If LOCKDIR does not exist it means that the lock is not active so
there's no need to do anything.
exit-post-hook-unlock.sh
patch
|
blob
|
history
diff --git
a/exit-post-hook-unlock.sh
b/exit-post-hook-unlock.sh
index
d618346
..
02d3648
100755
(executable)
--- a/
exit-post-hook-unlock.sh
+++ b/
exit-post-hook-unlock.sh
@@
-14,6
+14,8
@@
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; }