From bba8be6a42441daa9d3778e270642b706a366a34 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Tue, 30 Aug 2022 09:56:20 +0900 Subject: [PATCH] Exclude File check is if file is >0 and fix wrong check for tmp file Exclude file was only checked if it exists, even if it was empty it would start processing. In the exclude check there was also a wrong check for the tmp exclude file, it actually checked if the main exclude file was >0 instead of the tmp file. --- borg.backup.file.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/borg.backup.file.sh b/borg.backup.file.sh index 38b12bd..67c9036 100755 --- a/borg.backup.file.sh +++ b/borg.backup.file.sh @@ -92,8 +92,8 @@ while read include_folder; do fi; done<"${BASE_FOLDER}${INCLUDE_FILE}"; -# exclude list -if [ -f "${BASE_FOLDER}${EXCLUDE_FILE}" ]; then +# exclude list, only if file exists and is larger than zero +if [ -s "${BASE_FOLDER}${EXCLUDE_FILE}" ]; then printf "${PRINTF_SUB_BLOCK}" "EXCLUDE" "$(date +'%F %T')" "${MODULE}"; # check that the folders in that exclude file are actually valid, # remove non valid ones and warn @@ -147,7 +147,7 @@ if [ -f "${BASE_FOLDER}${EXCLUDE_FILE}" ]; then fi; done<"${BASE_FOLDER}${EXCLUDE_FILE}"; # avoid blank file add by checking if the tmp file has a size >0 - if [ -s "${BASE_FOLDER}${EXCLUDE_FILE}" ]; then + if [ -s "${TMP_EXCLUDE_FILE}" ]; then OPT_EXCLUDE="--exclude-from=${TMP_EXCLUDE_FILE}"; fi; fi;