]> git.treefish.org Git - backmeupscotty.git/commitdiff
Do not lock exclusively when listing backups
authorAlexander Schmidt <alex@treefish.org>
Tue, 26 Sep 2023 21:11:01 +0000 (23:11 +0200)
committerAlexander Schmidt <alex@treefish.org>
Tue, 26 Sep 2023 21:11:01 +0000 (23:11 +0200)
backmeupscotty

index 579b63a53e18f2f301d809e0be5a90fd76286926..65e4d53310b732200dc2c67edcd941f7caaf2b31 100644 (file)
@@ -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