check SQL vars are defined in details file

This commit is contained in:
Asif Bacchus 2019-05-27 06:17:38 -06:00
parent 62107ed611
commit 5e7d2fe6d2

View File

@ -381,6 +381,22 @@ printf "${cyan}[%s] -- [INFO] ${yellow}%s${cyan} imported --${norm}\n" \
### dump sql databases ### 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" \ printf "${cyan}[%s] -- [INFO] Dumping SQL databases --${norm}\n" \
"$(stamp)" >> "$logFile" "$(stamp)" >> "$logFile"
# create temporary directory to dump files before borg backup # create temporary directory to dump files before borg backup
@ -396,6 +412,7 @@ printf "\n${yellow}%s/${cyan} --${norm}\n" "$sqlDumpDir" >> "$logFile"
sqlDump_ccnet="backup-$(date +%Y%m%d_%H%M%S)_${ccnetDB_name}.sql" 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_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" sqlDump_seahub="backup-$(date +%Y%m%d_%H%M%S)_${seahubDB_name}.sql"
## dump databases ## dump databases
# dump CCNET-DB # dump CCNET-DB
if ! mysqldump -h"${sqlServer}" -u"${sqlUser}" -p"${sqlPass}" \ if ! mysqldump -h"${sqlServer}" -u"${sqlUser}" -p"${sqlPass}" \