save redis state

This commit is contained in:
Asif Bacchus 2018-10-20 04:47:50 -06:00
parent e50116752d
commit 4bc31ad274

View File

@ -268,7 +268,7 @@ warningExplain[2201]="Borg exited with an unknown return-code. Please check this
warningExplain[2210]="Borg prune exited with warnings. Please check this script's logfile for details" warningExplain[2210]="Borg prune exited with warnings. Please check this script's logfile for details"
warningExplain[2212]="Borg prune exited with an unknown return-code. Please check this script's logfile for details" warningExplain[2212]="Borg prune exited with an unknown return-code. Please check this script's logfile for details"
warningExplain[1001]="There was a problem dumping the SQL database. It has NOT been backed up" warningExplain[1001]="There was a problem dumping the SQL database. It has NOT been backed up"
warningExplain[1002]="There was a problem saving redis state information. It has NOT been backed up"
### Process script parameters ### Process script parameters
@ -488,7 +488,7 @@ fi
### Dump SQL ### Dump SQL
echo -e "${op}${stamp} Dumping mailcow SQL database...${normal}" >> "$logFile" echo -e "${op}${stamp} Dumping mailcow SQL database...${normal}" >> "$logFile"
docker-compose exec mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > "$sqlDumpDir/$sqlDumpFile" 2>> "$logFile" docker-compose exec mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > "$sqlDumpDir/$sqlDumpFile" >> "$logFile" 2>&1
dumpResult=$(docker-compose exec mysql-mailcow echo "$?") dumpResult=$(docker-compose exec mysql-mailcow echo "$?")
# verify sql dump was successful # verify sql dump was successful
if [ "$dumpResult" -eq 0 ]; then if [ "$dumpResult" -eq 0 ]; then
@ -499,6 +499,19 @@ else
fi fi
### Save redis state
echo -e "${op}${stamp} Saving redis state information...${normal}" >> "$logFile"
docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1
checkResult=$(docker-compose exec redis-mailcow echo "$?")
# Verify save was successful
if [ "$checkResult" -eq 0 ]; then
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
>> "$logFile"
else
exitWarn+=('1002')
fi
### Call borgbackup to copy actual files ### Call borgbackup to copy actual files
echo -e "${op}${stamp} Pre-backup tasks completed, calling borgbackup..." \ echo -e "${op}${stamp} Pre-backup tasks completed, calling borgbackup..." \
"${normal}" >> "$logFile" "${normal}" >> "$logFile"