Compare commits

..

No commits in common. "090ce7d7fb105e66410ea4a2f33f84e0a4752b3d" and "1c85071ca4c6fc4bf000b19698c6f8d5787a3c53" have entirely different histories.

1 changed files with 7 additions and 32 deletions

View File

@ -53,7 +53,6 @@ cleanup () {
printf " Web interface will not function until this file is " \
>> "$logFile"
printf "removed --${norm}\n" >> "$logFile"
warnCount=$((warnCount+1))
else
printf "${cyan}[%s] -- [INFO] 503 error page removed --${norm}\n" \
"$(stamp)" >> "$logFile"
@ -65,7 +64,6 @@ cleanup () {
"$(stamp)" >> "$logFile"
printf "SQL dump directory at %s. " "$sqlDumpDir" >> "$logFile"
printf "Remove manually to free up space.${norm}\n" >> "$logFile"
warnCount=$((warnCount+1))
else
printf "${cyan}[%s] -- [INFO] Temporary SQL dump directory " \
"$(stamp)" >> "$logFile"
@ -133,15 +131,14 @@ stamp () {
scriptPath="$( CDPATH='' cd -- "$( dirname -- "$0" )" && pwd -P )"
scriptName="$( basename "$0" )"
logFile="$scriptPath/${scriptName%.*}.log"
warnCount=0
# borg output verbosity -- normal
borgCreateParams='--stats'
borgPruneParams='--list'
configDetails="$scriptPath/seafbackup.details"
err503Copied=0
sqlCopied=0
includeXtra=0
exclusions=0
# borg output verbosity -- normal
borgCreateParams='--stats'
borgPruneParams='--list'
# 503 related
use503=0
@ -346,7 +343,6 @@ if [ "$use503" -eq 1 ]; then
printf "${warn}[%s] -- [WARNING] Failed to copy 503 error page. " \
"$(stamp)" >> "$logFile"
printf "Web users will NOT be notified --${norm}\n" >> "$logFile"
warnCount=$((warnCount+1))
else
printf "${ok}[%s] -- [SUCCESS] 503 error page copied --${norm}\n" \
"$(stamp)" >> "$logFile"
@ -417,7 +413,7 @@ printf "${ok}[%s] -- [SUCCESS] SQL databases dumped successfully --${norm}\n" \
### pre-backup tasks completed -- move to borg tasks
printf "${ok}[%s] -- [SUCCESS] Pre-backup tasks completed --${norm}\n" \
printf "${cyan}[%s] -- [INFO] Pre-backup tasks completed --${norm}\n" \
"$(stamp)" >> "$logFile"
@ -463,7 +459,6 @@ else
printf "${warn} -- [WARNING] Using a borg repo without a password is an " \
>> "$logFile"
printf "insecure configuration --${norm}\n" >> "$logFile"
warnCount=$((warnCount+1))
# if this was an accident, we need to provide a bogus passwd so borg fails
# otherwise it will sit forever just waiting for input
export BORG_PASSPHRASE="DummyPasswordSoBorgFails"
@ -561,7 +556,6 @@ elif [ "$borgResult" -eq 1 ]; then
printf "${warn}[%s] -- [WARNING] Borg completed with warnings. " \
"$(stamp)" >> "$logFile"
printf "Review this logfile for details --${norm}\n" >> "$logFile"
warnCount=$((warnCount+1))
elif [ "$borgResult" -ge 2 ]; then
err_1="Borg exited with a critical error. Please review this log file"
err_2="for details."
@ -570,7 +564,6 @@ else
printf "${warn}[%s] -- [WARNING] Borg exited with unknown return code. " \
"$(stamp)" >> "$logFile"
printf "Review this logfile for details --${norm}\n" >> "$logFile"
warnCount=$((warnCount+1))
fi
@ -586,7 +579,6 @@ else
"$(stamp)" >> "$logFile"
printf "Your archive will continue growing with each backup --${norm}\n" \
>> "$logFile"
warnCount=$((warnCount+1))
fi
## report on prune operation if executed
@ -598,7 +590,6 @@ if [ -n "${borgPruneResult}" ]; then
printf "${warn}[%s] -- [WARNING] Borg prune completed with warnings. " \
"$(stamp)" >> "$logFile"
printf "Review this logfile for details --${norm}\n" >> "$logFile"
warnCount=$((warnCount+1))
elif [ "$borgPruneResult" -ge 2 ]; then
err_1="Borg prune exited with a critical error. Please review this"
err_2="log file for details."
@ -608,34 +599,18 @@ if [ -n "${borgPruneResult}" ]; then
"$(stamp)" >> "$logFile"
printf "return code. Review this logfile for details --${norm}\n" \
>> "$logFile"
warnCount=$((warnCount+1))
fi
fi
### all processes successfully completed, cleanup and exit gracefully
# note successful completion of borg commands
printf "${ok}[%s] -- [SUCCESS] Backup operations completed --${norm}\n" \
"$(stamp)" >> "$logFile"
# cleanup
cleanup
# note complete success, tally warnings and exit
printf "${ok}[%s] -- [SUCCESS] All processes completed --${norm}\n" \
"$(stamp)" >> "$logFile"
printf "${mag}[%s] --- %s execution completed ---${norm}\n" \
"$(stamp)" "$scriptName" >> "$logFile"
if [ "$warnCount" -gt 0 ]; then
printf "${warn}%s warnings issued!${norm}\n" "${warnCount}" >> "$logFile"
else
printf "${ok}0 warnings issued.${norm}\n" >> "$logFile"
fi
exit 0
### error codes
# 1: parameter error
# 2: not run as root