]> git.sesse.net Git - backup.sh/commitdiff
Fix a bug where the lock file would be removed if seen from a different process.
authorSteinar H. Gunderson <sesse@samfundet.no>
Wed, 8 Oct 2014 08:41:24 +0000 (10:41 +0200)
committerSteinar H. Gunderson <sesse@samfundet.no>
Wed, 8 Oct 2014 08:41:24 +0000 (10:41 +0200)
backup.sh

index 29ffa1fc17938a65831f90079d551323defd60ee..f4ae98bb0ab7dde18f3aee1df337786472ed50ae 100755 (executable)
--- 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