commit e9d8af262eb5e25536ea9778e3ed57aebb55488c
parent 62e232ef76fe95a30283b35dd56f09cc98a11416
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Tue, 15 Dec 2015 14:11:21 +0100
improve locking
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sbin/snap.lvm2 b/sbin/snap.lvm2
@@ -13,7 +13,8 @@ export SNAPSHOT
LOCKDIR=/var/lock/snaprep
test -d "$LOCKDIR" || mkdir -p "$LOCKDIR" || exit $?
LOCKFILE="$LOCKDIR/lvm2.${SRC//\//-}"
-if ! flock -n "$LOCKFILE"; then
+# since LVM implies Linux, I'm assuming the presence of the flock utility
+if ! flock -n "$LOCKFILE" true; then
echo >&2 "locked: $SRC"
exit 1
fi