diff --git a/backup.sh b/backup.sh index aaa2f8b..afe9b88 100755 --- a/backup.sh +++ b/backup.sh @@ -477,9 +477,9 @@ export logFile="$logFile" ### Create sqlDump temporary directory and sqlDumpFilenames sqlDumpDir=$( mktemp -d ) -sqlDump_ccnet-db="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_seahub-db="backup-$(date +%Y%m%d_%H%M%S)_seahub-db.sql" +sqlDump_ccnet="backup-$(date +%Y%m%d_%H%M%S)_ccnet-db.sql" +sqlDump_seafile="backup-$(date +%Y%m%d_%H%M%S)_seafile-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" \ "stored at: ${lit}${sqlDumpDir}/${sqlDumpFile}${normal}" >> "$logFile" @@ -557,13 +557,20 @@ mapfile -t sqlParams < "$sqlDetails" ### Dump SQL -echo -e "${op}[$(stamp)] Dumping Seafile SQL database...${normal}" >> "$logFile" -mysqldump --single-transaction -h"${sqlParams[0]}" -u"${sqlParams[1]}" \ - -p"${sqlParams[2]}" "${sqlParams[3]}" > "${sqlDumpDir}/${sqlDumpFile}" \ - 2>> "$logFile" +echo -e "${op}[$(stamp)] Dumping Seafile SQL databases...${normal}" \ + >> "$logFile" +mysqldump -h"${sqlParams[0]}" -u"${sqlParams[1]}" -p"${sqlParams[2]}" --opt \ + 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 -dumpResult="$?" -if [ "$dumpResult" = "0" ]; then +if [ "$dumpResult_ccnet" -eq 0 ] && [ "$dumpResult_seafile" -eq 0 ] && \ + [ "$dumpResult_seahub" -eq 0 ]; then echo -e "${ok}[$(stamp)] -- [SUCCESS] SQL dumped successfully --${normal}" \ >> "$logFile" else