From d3303892e4f393d994804016060a8bc704acfebb Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 8 Oct 2014 10:41:24 +0200 Subject: [PATCH 1/1] Fix a bug where the lock file would be removed if seen from a different process. --- backup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backup.sh b/backup.sh index 29ffa1f..f4ae98b 100755 --- a/backup.sh +++ b/backup.sh @@ -68,9 +68,10 @@ infomsg() { # Trap C-c and kill trap die SIGINT SIGTERM -# Don't start if we're already running +# Don't start if we're already running. Don't use diemsg, as that removes the lock file! if [ -e $LOCKFILE ]; then - diemsg "$LOCKFILE exists for pid `cat $LOCKFILE`." + warnmsg "$LOCKFILE exists for pid `cat $LOCKFILE`." + exit 1 fi; touch $LOCKFILE echo $$ > $LOCKFILE -- 2.39.2