Compare commits

..

No commits in common. "5af5a064a92ba7bfde93412ec1e5d3350fc49d0d" and "3c5d766d0c4385602d0f9819d25a2f56cad045ee" have entirely different histories.

View File

@ -144,15 +144,6 @@ function checkExist {
# not found # not found
return 1 return 1
fi fi
elif [ "$1" = "fs" ]; then
# find file > 0 bytes
if [ -s "$2" ]; then
# found
return 0
else
# not found
return 1
fi
elif [ "$1" = "fd" ]; then elif [ "$1" = "fd" ]; then
# find directory # find directory
if [ -d "$2" ]; then if [ -d "$2" ]; then
@ -565,29 +556,27 @@ 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" 2>> "$logFile"
## error checking sqldump within the container in a cron-friendly manner is a checkResult=$(docker-compose exec -T mysql-mailcow echo $?)
## nightmare, so let's just see if a non-empty file with the expected name was # verify sql dump was successful
## created if [ "$checkResult" = 0 ]; then
checkExist fs "$sqlDumpDir/$sqlDumpFile" echo -e "${ok}${stamp} -- [SUCCESS] SQL successfully dumped --${normal}" \
checkResult="$?" >> "$logFile"
if [ "$checkResult" = "0" ]; then else
echo -e "${ok}${stamp} -- [SUCCESS] SQL successfully dumped --" \ exitError+=("${stamp}_201")
"${normal}" >> "$logFile" fi
else
exitError+=("${stamp}_201")
fi
### Save redis state ### Save redis state
echo -e "${op}${stamp} Saving redis state information...${normal}" >> "$logFile" echo -e "${op}${stamp} Saving redis state information...${normal}" >> "$logFile"
docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1 docker-compose exec redis-mailcow redis-cli save >> "$logFile" 2>&1
## redis outputs a simple 'OK' if the export succeeded, so check the log file checkResult=$(docker-compose exec -T redis-mailcow echo "$?")
## for a line just written that says that specifically # Verify save was successful
if [ $(tail -1 "$logFile") = "OK" ]; if [ "$checkResult" = 0 ]; then
echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \ echo -e "${ok}${stamp} -- [SUCCESS] redis state saved --${normal}" \
>> "$logFile" >> "$logFile"
else else
exitError+=("${stamp}_202") exitError+=("${stamp}_202")
fi fi
### Call borgbackup to copy actual files ### Call borgbackup to copy actual files