From bf0364a0e7e4d3577089c96453fd0f7309f8aa7d Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Mon, 25 Apr 2022 08:57:01 +0900 Subject: [PATCH] Move lock file clean up to before any exit info is printed Just try to clean lock file always on exit --- borg.backup.functions.close.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/borg.backup.functions.close.sh b/borg.backup.functions.close.sh index 6cb2e77..8730511 100644 --- a/borg.backup.functions.close.sh +++ b/borg.backup.functions.close.sh @@ -7,14 +7,14 @@ fi; # unset borg settings unset BORG_BASE_DIR BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK BORG_RELOCATED_REPO_ACCESS_IS_OK +# delete lock file if it exists +if [ -f "${BASE_FOLDER}${BACKUP_LOCK_FILE}" ]; then + rm "${BASE_FOLDER}${BACKUP_LOCK_FILE}"; +fi; # error abort without duration and error notice if [ $# -ge 1 ] && [ "$1" = "1" ]; then printf "${PRINTF_MASTER_BLOCK}" "ERROR" "$(date +'%F %T')" "${MODULE}"; else - # delete lock file - if [ -f "${BASE_FOLDER}${BACKUP_LOCK_FILE}" ]; then - rm "${BASE_FOLDER}${BACKUP_LOCK_FILE}"; - fi; # running time calculation DURATION=$[ $(date +'%s')-$START ]; echo "=== [Run time: $(convert_time ${DURATION})]";