Compare commits

...

2 Commits

Author SHA1 Message Date
Asif Bacchus
7293a29a05 include mailcow.conf directory in backup 2020-05-07 04:59:37 -06:00
Asif Bacchus
8486c4b7d2 make xtraList optional 2020-05-07 04:58:26 -06:00

View File

@ -469,28 +469,6 @@ printf "%s[%s] -- [INFO] %s%s%s imported --%s\n" \
printf "%s[%s] -- [INFO] Verifying supplied borg details --%s\n" \ printf "%s[%s] -- [INFO] Verifying supplied borg details --%s\n" \
"$cyan" "$(stamp)" "$norm" >> "$logFile" "$cyan" "$(stamp)" "$norm" >> "$logFile"
## read additional files -- this is required otherwise nothing to backup!
if [ -z "${borgXtraListPath}" ]; then
badDetails empty 'xtraLocations'
else
# check if file actually exists
if [ ! -f "${borgXtraListPath}" ]; then
badDetails dne 'borgXtraListPath'
fi
# read file contents into concatenated list for echo to cmdline
while read -r xtraItem; do
if [ -z "${xtraList}" ]; then
xtraList="${xtraItem}"
else
xtraList="${xtraList} ${xtraItem}"
fi
done <<EOF
$( sed -e '/^\s*#.*$/d' -e '/^\s*$/d' "${borgXtraListPath}" )
EOF
printf "%sdetails:borgXtraListPath %s-- %s[OK]%s\n" \
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
fi
## verify borg base directory ## verify borg base directory
if [ -z "${borgBaseDir}" ]; then if [ -z "${borgBaseDir}" ]; then
badDetails empty 'borgBaseDir' badDetails empty 'borgBaseDir'
@ -559,6 +537,28 @@ if [ -n "${borgExcludeListPath}" ]; then
exclusions=1 exclusions=1
fi fi
## read additional files
if [ -z "${borgXtraListPath}" ]; then
xtraList=''
else
# check if file actually exists
if [ ! -f "${borgXtraListPath}" ]; then
badDetails dne 'borgXtraListPath'
fi
# read file contents into concatenated list for echo to cmdline
while read -r xtraItem; do
if [ -z "${xtraList}" ]; then
xtraList="${xtraItem}"
else
xtraList="${xtraList} ${xtraItem}"
fi
done <<EOF
$( sed -e '/^\s*#.*$/d' -e '/^\s*$/d' "${borgXtraListPath}" )
EOF
printf "%sdetails:borgXtraListPath %s-- %s[OK]%s\n" \
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
fi
### set location of sql dump ### set location of sql dump
# this is done before resetting default TMP dir for borg # this is done before resetting default TMP dir for borg
@ -670,6 +670,7 @@ printf "%s[%s] -- [INFO] Pre-backup tasks completed, calling borgbackup --%s\n"
if [ "$exclusions" -eq 0 ]; then if [ "$exclusions" -eq 0 ]; then
borgCMD="borg --show-rc create ${borgCreateParams} \ borgCMD="borg --show-rc create ${borgCreateParams} \
::$(date +%Y-%m-%d_%H%M%S) \ ::$(date +%Y-%m-%d_%H%M%S) \
${mcConfig%/*} \
${sqlDumpDir} \ ${sqlDumpDir} \
${dockerVolumeMail} \ ${dockerVolumeMail} \
${dockerVolumeRspamd} \ ${dockerVolumeRspamd} \
@ -681,6 +682,7 @@ elif [ "$exclusions" -eq 1 ]; then
borgCMD="borg --show-rc create ${borgCreateParams} \ borgCMD="borg --show-rc create ${borgCreateParams} \
--exclude-from ${borgExcludeListPath} \ --exclude-from ${borgExcludeListPath} \
::$(date +%Y-%m-%d_%H%M%S) \ ::$(date +%Y-%m-%d_%H%M%S) \
${mcConfig%/*} \
${sqlDumpDir} \ ${sqlDumpDir} \
${dockerVolumeMail} \ ${dockerVolumeMail} \
${dockerVolumeRspamd} \ ${dockerVolumeRspamd} \