use dbnames from details file for dump

This commit is contained in:
Asif Bacchus 2019-06-20 03:39:57 -06:00
parent 6fec178fae
commit 4e5bfa49b4

View File

@ -492,7 +492,8 @@ if [ -z "${sqlPass}" ]; then
badDetails empty 'sqlPass'
fi
# database names
if [ -z "${ccnetDB_name}" ] || [ -z "${seafileDB_name}" ] || [ -z "${seahubDB_name}" ]; then
if [ -z "${ccnetDB_name}" ] || [ -z "${seafileDB_name}" ] || \
[ -z "${seahubDB_name}" ]; then
badDetails empty 'one or more mysql database names'
fi
@ -516,17 +517,19 @@ 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}" \
--opt ccnet-db > "${sqlDumpDir}/${sqlDump_ccnet}" 2>> "$logFile"; then
--opt "${ccnetDB_name}" > "${sqlDumpDir}/${sqlDump_ccnet}" \
2>> "$logFile"; then
exitError 115 "Could not dump ${ccnetDB_name} database"
fi
# dump SEAFILE-DB
if ! mysqldump -h"${sqlServer}" -u"${sqlUser}" -p"${sqlPass}" \
--opt ccnet-db > "${sqlDumpDir}/${sqlDump_seafile}" 2>> "$logFile"; then
--opt "${seafileDB_name}" > "${sqlDumpDir}/${sqlDump_seafile}" \
2>> "$logFile"; then
exitError 116 "Could not dump ${seafileDB_name} database"
fi
# dump CCNET-DB
if ! mysqldump -h"${sqlServer}" -u"${sqlUser}" -p"${sqlPass}" \
--opt ccnet-db > "${sqlDumpDir}/${sqlDump_seahub}" 2>> "$logFile"; then
--opt "${seahubDB_name}" > "${sqlDumpDir}/${sqlDump_seahub}" 2>> "$logFile"; then
exitError 117 "Could not dump ${seahubDB_name} database"
fi
printf "${ok}[%s] -- [SUCCESS] SQL databases dumped successfully --${norm}\n" \