From: Alexander Schmidt Date: Tue, 26 Sep 2023 21:11:01 +0000 (+0200) Subject: Do not lock exclusively when listing backups X-Git-Url: https://git.treefish.org/~alex/backmeupscotty.git/commitdiff_plain/2da8ed681614289264c6069c03921b418b77b0ef Do not lock exclusively when listing backups --- diff --git a/backmeupscotty b/backmeupscotty index 579b63a..65e4d53 100644 --- a/backmeupscotty +++ b/backmeupscotty @@ -190,6 +190,15 @@ Recognized options: EOF } +function exclusiveLock { + if ! mkdir /var/lock/$(basename $0); then + scottyerror "Another instance of $(basename $0) is still running!" + exit 1 + else + trap deleteLock EXIT + fi +} + function backmeupscotty { while getopts "qn:flh" opt; do case $opt in @@ -221,6 +230,8 @@ function backmeupscotty { exit 0 fi + exclusiveLock + if [ $BACKUP_FORCE -eq 1 ]; then scottyinfo "Backup was enforced." elif latestTooOld; then @@ -243,10 +254,3 @@ function backmeupscotty { exit 0 } - -if ! mkdir /var/lock/$(basename $0); then - scottyerror "Another instance of $(basename $0) is still running!" - exit 1 -else - trap deleteLock EXIT -fi