Compare commits

..

No commits in common. "5e7d2fe6d2454065d6df2125ffd5a7421968a03c" and "090ce7d7fb105e66410ea4a2f33f84e0a4752b3d" have entirely different histories.

1 changed files with 10 additions and 27 deletions

View File

@ -12,7 +12,7 @@ warn=$(tput bold)$(tput setaf 3)
ok=$(tput setaf 2)
yellow=$(tput setaf 3)
cyan=$(tput setaf 6)
magenta=$(tput setaf 5)
mag=$(tput setaf 5)
### functions
@ -330,7 +330,7 @@ fi
### start logging
printf "${magenta}[%s] --- Start %s execution ---${norm}\n" \
printf "${mag}[%s] --- Start %s execution ---${norm}\n" \
"$(stamp)" "$scriptName" >> "$logFile"
printf "${cyan}[%s] -- [INFO] Log located at ${yellow}%s${cyan} --${norm}\n" \
"$(stamp)" "$logFile" >> "$logFile"
@ -381,26 +381,10 @@ printf "${cyan}[%s] -- [INFO] ${yellow}%s${cyan} imported --${norm}\n" \
### dump sql databases
## verify SQL variables are defined in details file
# sqlServer
if [ -z "${sqlServer}" ]; then
badDetails empty 'sqlServer'
fi
# sqlUser
if [ -z "${sqlUser}" ]; then
badDetails empty 'sqlUser'
fi
# sqlPass
if [ -z "${sqlPass}" ]; then
badDetails empty 'sqlPass'
fi
## create tmp directory and generate dumpfile names
printf "${cyan}[%s] -- [INFO] Dumping SQL databases --${norm}\n" \
"$(stamp)" >> "$logFile"
# create temporary directory to dump files before borg backup
if ! sqlDumpDir=$( mktemp -d 2>>"$logFile" ); then
if ! sqlDumpDir=$( mktemp -d 2>>"$logFile"); then
exitError 111 "Could not create temporary directory to dump SQL files"
fi
# set cleanup flag
@ -412,7 +396,6 @@ printf "\n${yellow}%s/${cyan} --${norm}\n" "$sqlDumpDir" >> "$logFile"
sqlDump_ccnet="backup-$(date +%Y%m%d_%H%M%S)_${ccnetDB_name}.sql"
sqlDump_seafile="backup-$(date +%Y%m%d_%H%M%S)_${seafileDB_name}.sql"
sqlDump_seahub="backup-$(date +%Y%m%d_%H%M%S)_${seahubDB_name}.sql"
## dump databases
# dump CCNET-DB
if ! mysqldump -h"${sqlServer}" -u"${sqlUser}" -p"${sqlPass}" \
@ -449,7 +432,7 @@ elif [ ! -d "${borgBaseDir}" ]; then
badDetails dne 'borgBaseDir'
fi
printf "${magenta}details:borgBaseDir ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logFile"
>> "$logfile"
export BORG_BASE_DIR="${borgBaseDir%/}"
## check path to SSH keyfile
@ -459,7 +442,7 @@ elif [ ! -d "${borgSSHKey}" ]; then
badDetails dne 'borgSSHKey'
fi
printf "${magenta}details:borgSSHKey ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logFile"
>> "$logfile"
export BORG_RSH="ssh -i ${borgSSHKey}"
## check borg repo connect string
@ -467,13 +450,13 @@ if [ -z "${borgConnectRepo}" ]; then
badDetails empty 'borgConnectRepo'
fi
printf "${magenta}details:borgConnectRepo ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logFile"
>> "$logfile"
export BORG_REPO="${borgConnectRepo}"
## check borg repo password
if [ -n "${borgRepoPassphrase}" ]; then
printf "${magenta}details:borgRepoPassphrase ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logFile"
>> "$logfile"
export BORG_PASSPHRASE="${borgRepoPassphrase}"
else
# if passwd is blank intentionally, this is insecure
@ -506,7 +489,7 @@ if [ -n "${borgXtraListPath}" ]; then
$( sed -e '/^\s*#.*$/d' -e '/^\s*$/d' "${borgXtraListPath}" )
EOF
printf "${magenta}details:borgXtraListPath ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logFile"
>> "$logfile"
includeXtra=1
fi
@ -595,7 +578,7 @@ fi
if [ -n "${borgPruneSettings}" ]; then
printf "${cyan}[%s] -- [INFO] Executing borg prune operation --${norm}\n" \
"$(stamp)" >> "$logFile"
borg prune --show-rc -v "${borgPruneParams}" "${borgPruneSettings}" \
borg prune --show-rc -v ${borgPruneParams} ${borgPruneSettings} \
2>> "$logFile"
borgPruneResult="$?"
else
@ -642,7 +625,7 @@ cleanup
# note complete success, tally warnings and exit
printf "${ok}[%s] -- [SUCCESS] All processes completed --${norm}\n" \
"$(stamp)" >> "$logFile"
printf "${magenta}[%s] --- %s execution completed ---${norm}\n" \
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"