execute borg prune and report results

This commit is contained in:
Asif Bacchus 2019-05-27 05:08:09 -06:00
parent 78bdc0e5d6
commit 5e5e50b8e8
1 changed files with 44 additions and 2 deletions

View File

@ -552,7 +552,7 @@ elif [ "$borgResult" -eq 1 ]; then
"$(stamp)" >> "$logFile"
printf "Review this logfile for details --${norm}\n" >> "$logFile"
elif [ "$borgResult" -ge 2 ]; then
exitError 139 "Borg exited with a critical error. \
exitError 138 "Borg exited with a critical error. \
Review this log for details"
else
printf "${warn}[%s] -- [WARNING] Borg exited with uknown return code. " \
@ -561,6 +561,46 @@ else
fi
### execute borg prune if paramters are provided, otherwise skip with a warning
if [ -n "${borgPruneSettings}" ]; then
printf "${cyan}[%s] -- [INFO] Executing borg prune operation --${norm}\n" \
"$(stamp)" >> "$logFile"
borg prune --show-rc -v ${borgPruneParams} ${borgPruneSettings} \
2>> "$logFile"
borgPruneResult="$?"
else
printf "${warn}[%s] -- [WARNING] No prune parameters provided. " \
"$(stamp)" >> "$logFile"
printf "Your archive will continue growing with each backup --${norm}\n" \
>> "$logFile"
fi
## report on prune operation if executed
if [ -n "${borgPruneResult}" ]; then
if [ "${borgPruneResult}" -eq 0 ]; then
printf "${ok}[%s] -- [SUCCESS] Borg prune completed --${norm}\n" \
"$(stamp)" >> "$logFile"
elif [ "$borgPruneResult" -eq 1 ]; then
printf "${warn}[%s] -- [WARNING] Borg prune completed with warnings. " \
"$(stamp)" >> "$logFile"
printf "Review this logfile for details --${norm}\n" >> "$logFile"
elif [ "$borgPruneResult" -ge 2 ]; then
exitError 139 "Borg prune exited with a critical error. \
Review this log for details"
else
printf "${warn}[%s] -- [WARNING] Borg prune exited with an unknown " \
"$(stamp)" >> "$logFile"
printf "return code. Review this logfile for details --${norm}\n" \
>> "$logFile"
fi
fi
exit 0
@ -577,4 +617,6 @@ exit 0
# 116: could not dump SEAFILE-DB
# 117: could not dump SEAHUB-DB
# 130: null borg configuration variable
# 131: invalid borg configuration variable
# 131: invalid borg configuration variable
# 138: borg exited with a critical error
# 139: borg prune exited with a critical error