From 0d018e3b6522eaf06900fcd9c8468352438f08bf Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 16 Oct 2018 02:07:47 -0600 Subject: [PATCH] Updated exclusion processing section to only warn if errant file specified. Logs if no file specified to begin with. --- root/NCscripts/backup.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/root/NCscripts/backup.sh b/root/NCscripts/backup.sh index d55e64f..d8c7599 100755 --- a/root/NCscripts/backup.sh +++ b/root/NCscripts/backup.sh @@ -627,18 +627,24 @@ if [ -n "$borgXtra" ]; then fi ## Check if borgExclude exists since borg will throw an error if it's missing -checkExist ff "$borgExclude" -checkResult="$?" -if [ "$checkResult" = "0" ]; then - echo -e "${op}${stamp} Found ${lit}${borgExclude}${normal}" \ - >> "$logFile" +if [ -n "$borgExclude" ]; then + checkExist ff "$borgExclude" + checkResult="$?" + if [ "$checkResult" = "0" ]; then + echo -e "${op}${stamp} Found ${lit}${borgExclude}${normal}" \ + >> "$logFile" + else + # file not found, unset the variable so it's like it was not specified + # in the first place and continue with backup + unset borgExclude + exitWarn+=('2114') + fi else - # file not found, unset the variable so it's like it was not specified - # in the first place and continue with backup - unset borgExclude - exitWarn+=('2114') + echo -e "${op}${stamp} Exclusion pattern file not specified." \ + "No exclusions will be processed${normal}" >> "$logFile" fi + ## Export TMPDIR environment variable for borg via python ## Python requires a writable temporary directory when unpacking borg and ## executing commands. This defaults to /tmp but many systems mount /tmp with