Fixed error checking for sqldump and redis dump. Used -T param in exec

This commit is contained in:
Asif Bacchus 2018-10-25 05:17:14 -06:00
parent 7eebd44ce4
commit 3c5d766d0c

View File

@ -556,9 +556,9 @@ fi
### Dump SQL
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"
checkResult=$(docker-compose exec mysql-mailcow echo "$?")
checkResult=$(docker-compose exec -T mysql-mailcow echo $?)
# verify sql dump was successful
if [ "$checkResult"=0 ]; then
if [ "$checkResult" = 0 ]; then
echo -e "${ok}${stamp} -- [SUCCESS] SQL successfully dumped --${normal}" \
>> "$logFile"
else
@ -569,9 +569,9 @@ 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 "$?")
checkResult=$(docker-compose exec -T redis-mailcow echo "$?")
# Verify save was successful
if [ "$checkResult"=0 ]; then
if [ "$checkResult" = 0 ]; then
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
>> "$logFile"
else