backup2me.sh: Fix lock not preventing the execution of the rest of the script

This commit is contained in:
Alice Gaudon 2019-06-02 15:15:49 +02:00
parent e73cecf0ef
commit 1a51f3426d

View File

@ -10,8 +10,11 @@ function join {
printf "%s" "${@/#/$d$p}"; 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 ### ### Program arguments ###
# Backup target directory # Backup target directory