Updated BorgBackup sections to use new logging variables

This commit is contained in:
Asif Bacchus 2018-09-06 03:30:43 -06:00
parent c7b9ec9bcd
commit 4d43b03419

View File

@ -321,39 +321,43 @@ export BORG_PASSPHRASE="$(tail -1 $borgDetails)"
mapfile -t xtraFiles < $borgXtraFiles mapfile -t xtraFiles < $borgXtraFiles
## Call BorgBackup ## Call BorgBackup
borg --show-rc create --list --exclude-from $borgExcludeFiles \ borg --show-rc create ${borgCreateParams} --exclude-from $borgExcludeFiles \
--checkpoint-interval $borgCheckpoint ::`date +%Y-%m-%d_%H%M%S` \ --checkpoint-interval $borgCheckpoint ::`date +%Y-%m-%d_%H%M%S` \
"${xtraFiles[@]}" \ "${xtraFiles[@]}" \
"$ncdata" \ "$ncdata" \
"$sqlDumpDir/$sqlDumpFile" 2>> $logFile "$sqlDumpDir/$sqlDumpFile" >> $logFile 2>&1
borgCreateResult=$(echo "$?")
# Report BorgBackup exit status # Report BorgBackup exit status
if [ "$?" = "0" ]; then if [ "$borgCreateResult" = "0" ]; then
echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Success--" \ echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`] --SUCCESS--" \
"BorgBackup completed successfully.\e[0m" >> $logFile "BorgBackup completed successfully.\e[0m" >> $logFile
elif [ "$?" = "1" ]; then elif [ "$borgCreateResult" = "1" ]; then
echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Warning--" \ echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --WARNING--" \
"BorgBackup completed with WARNINGS." >> $logFile "BorgBackup completed with WARNINGS." >> $logFile
echo -e "--Warning-- Please check Borg's output.\e[0m" >> $logFile echo -e "--Warning-- Please check Borg's output.\e[0m" >> $logFile
else else
echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Error--" \ echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] --ERROR--" \
"BorgBackup encountered a serious ERROR." >> $logFile "BorgBackup encountered a serious ERROR." >> $logFile
echo -e "--Error-- Please check Borg's output.\e[0m" >> $logFile echo -e "--Error-- Please check Borg's output.\e[0m" >> $logFile
fi fi
## Have BorgBackup prune the repo to remove old archives ## Have BorgBackup prune the repo to remove old archives
borg --show-rc prune -v --list ${borgPrune} :: 2>> $logFile borg --show-rc prune -v ${borgPruneParams} ${borgPrune} :: >> $logFile 2>&1
borgPruneResult=$(echo "$?")
# Report BorgBackup exit status # Report BorgBackup exit status
if [ "$?" = "0" ]; then if [ "$borgPruneResult" = "0" ]; then
echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Success--" \ echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`] --SUCCESS--" \
"BorgBackup PRUNE operation completed successfully.\e[0m" >> $logFile "BorgBackup PRUNE operation completed successfully.\e[0m" >> $logFile
elif [ "$?" = "1" ]; then elif [ "$borgPruneResult" = "1" ]; then
echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Warning--" \ echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --WARNING--" \
"BorgBackup PRUNE operation completed with WARNINGS." >> $logFile "BorgBackup PRUNE operation completed with WARNINGS." >> $logFile
echo -e "--Warning-- Please check Borg's output.\e[0m" >> $logFile echo -e "--Warning-- Please check Borg's output.\e[0m" >> $logFile
else else
echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Error--" \ echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] --ERROR--" \
"BorgBackup PRUNE operation encountered a serious ERROR." >> $logFile "BorgBackup PRUNE operation encountered a serious ERROR." >> $logFile
echo -e "--Error-- Please check Borg's output.\e[0m" >> $logFile echo -e "--Error-- Please check Borg's output.\e[0m" >> $logFile
fi fi