From 1a51f3426d993cbb7e8e1c9e30ad0b253717dfb6 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 2 Jun 2019 15:15:49 +0200 Subject: [PATCH] backup2me.sh: Fix lock not preventing the execution of the rest of the script --- backup2me.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backup2me.sh b/backup2me.sh index 30f9c5d..22e73c2 100755 --- a/backup2me.sh +++ b/backup2me.sh @@ -10,8 +10,11 @@ function join { printf "%s" "${@/#/$d$p}"; } -lockfile-create -p -r 2 $0 || (echo "Another backup is running, aborting" & exit 1) - +if ! lockfile-create -p -r 2 $0; then + echo "Another backup is running, aborting" + exit 1 +fi + ### Program arguments ### # Backup target directory