Compare commits

..

No commits in common. "3c5d766d0c4385602d0f9819d25a2f56cad045ee" and "062ef420ec51c52c30429028883891d223c71434" have entirely different histories.

View File

@ -197,7 +197,7 @@ function cleanup {
## restart mailflow docker containers
# start and verify postfix
operateDocker start postfix
if [ "$dockerResultState" = "true" ]; then
if [ "$dockerResult" = "true" ]; then
echo -e "${info}${stamp} -- [INFO] Postfix container is running --" \
"${normal}" >> "$logFile"
else
@ -205,7 +205,7 @@ function cleanup {
fi
# start and verify dovecot
operateDocker start dovecot
if [ "$dockerResultState" = "true" ]; then
if [ "$dockerResult" = "true" ]; then
echo -e "${info}${stamp} -- [INFO] Dovecot container is running --" \
"${normal}" >> "$logFile"
else
@ -221,19 +221,14 @@ if [ "$1" = "stop" ]; then
>> "$logFile"
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
2>> "$logFile"
# verify container stopped (should return true)
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
# verify clean stop (exit code 0)
dockerResultExit=$(docker inspect -f '{{ .State.ExitCode }}' \
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
# verify
dockerResult=$(docker inspect -f '{{ .State.ExitCode }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
elif [ "$1" = "start" ]; then
echo -e "${op}${stamp} Starting ${2}-mailcow container...${normal}" \
>> "$logFile"
docker-compose start ${2}-mailcow 2>> "$logFile"
# verify
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
dockerResult=$(docker inspect -f '{{ .State.Running }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
fi
}
@ -443,9 +438,6 @@ echo -e "${info}${stamp} -- [INFO] using ${lit}${dockerComposeFilePath}" \
### Import additional variables from mailcow configuration file
source "${mailcowConfigFilePath}"
### Export PATH so this script can access all docker and docker-compose commands
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
### Export logFile variable for use by Borg
export logFile="$logFile"
@ -532,7 +524,7 @@ cd "$mailcowPath"
## Stop postfix-mailcow container
operateDocker stop postfix
# process result
if [ "$dockerResultState" = "false" ] && [ "$dockerResultExit" -eq 0 ]; then
if [ "$dockerResult" -eq 0 ]; then
echo -e "${info}${stamp} -- [INFO] Postfix container stopped --${normal}" \
>> "$logFile"
else
@ -543,7 +535,7 @@ fi
## Stop dovecot-mailcow container
operateDocker stop dovecot
# process result
if [ "$dockerResultState" = "false" ] && [ "$dockerResultExit" -eq 0 ]; then
if [ "$dockerResult" -eq 0 ]; then
echo -e "${info}${stamp} -- [INFO] Dovecot container stopped --${normal}" \
>> "$logFile"
else
@ -556,9 +548,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 -T mysql-mailcow echo $?)
checkResult=$(docker-compose exec 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 +561,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 -T redis-mailcow echo "$?")
checkResult=$(docker-compose exec 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