update SQL dump and var names

This commit is contained in:
Asif Bacchus 2019-05-19 01:21:02 -06:00
parent ff9f970f39
commit bc77da716f

View File

@ -477,9 +477,9 @@ export logFile="$logFile"
### Create sqlDump temporary directory and sqlDumpFilenames ### Create sqlDump temporary directory and sqlDumpFilenames
sqlDumpDir=$( mktemp -d ) sqlDumpDir=$( mktemp -d )
sqlDump_ccnet-db="backup-$(date +%Y%m%d_%H%M%S)_ccnet-db.sql" sqlDump_ccnet="backup-$(date +%Y%m%d_%H%M%S)_ccnet-db.sql"
sqlDump_seafile-db="backup-$(date +%Y%m%d_%H%M%S)_seafile-db.sql" sqlDump_seafile="backup-$(date +%Y%m%d_%H%M%S)_seafile-db.sql"
sqlDump_seahub-db="backup-$(date +%Y%m%d_%H%M%S)_seahub-db.sql" sqlDump_seahub="backup-$(date +%Y%m%d_%H%M%S)_seahub-db.sql"
echo -e "${info}[$(stamp)] -- [INFO] mySQL dump files will be temporarily" \ echo -e "${info}[$(stamp)] -- [INFO] mySQL dump files will be temporarily" \
"stored at: ${lit}${sqlDumpDir}/${sqlDumpFile}${normal}" >> "$logFile" "stored at: ${lit}${sqlDumpDir}/${sqlDumpFile}${normal}" >> "$logFile"
@ -557,13 +557,20 @@ mapfile -t sqlParams < "$sqlDetails"
### Dump SQL ### Dump SQL
echo -e "${op}[$(stamp)] Dumping Seafile SQL database...${normal}" >> "$logFile" echo -e "${op}[$(stamp)] Dumping Seafile SQL databases...${normal}" \
mysqldump --single-transaction -h"${sqlParams[0]}" -u"${sqlParams[1]}" \ >> "$logFile"
-p"${sqlParams[2]}" "${sqlParams[3]}" > "${sqlDumpDir}/${sqlDumpFile}" \ mysqldump -h"${sqlParams[0]}" -u"${sqlParams[1]}" -p"${sqlParams[2]}" --opt \
2>> "$logFile" ccnet-db > "${sqlDumpDir}/${sqlDump_ccnet}" 2>> "$logFile"
dumpResult_ccnet=$?
mysqldump -h"${sqlParams[0]}" -u"${sqlParams[1]}" -p"${sqlParams[2]}" --opt \
seafile-db > "${sqlDumpDir}/${sqlDump_seafile}" 2>> "$logFile"
dumpResult_seafile=$?
mysqldump -h"${sqlParams[0]}" -u"${sqlParams[1]}" -p"${sqlParams[2]}" --opt \
seahub-db > "${sqlDumpDir}/${sqlDump_seahub}" 2>> "$logFile"
dumpResult_seahub=$?
# verify # verify
dumpResult="$?" if [ "$dumpResult_ccnet" -eq 0 ] && [ "$dumpResult_seafile" -eq 0 ] && \
if [ "$dumpResult" = "0" ]; then [ "$dumpResult_seahub" -eq 0 ]; then
echo -e "${ok}[$(stamp)] -- [SUCCESS] SQL dumped successfully --${normal}" \ echo -e "${ok}[$(stamp)] -- [SUCCESS] SQL dumped successfully --${normal}" \
>> "$logFile" >> "$logFile"
else else