Added container state check to container stop report section
This commit is contained in:
parent
a123b17d52
commit
509a858038
@ -222,17 +222,17 @@ if [ "$1" = "stop" ]; then
|
|||||||
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
|
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
|
||||||
2>> "$logFile"
|
2>> "$logFile"
|
||||||
# verify container stopped (should return true)
|
# verify container stopped (should return true)
|
||||||
dockerResultStop1=$(docker inspect -f '{{ .State.Running }}' \
|
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
||||||
# verify clean stop (exit code 0)
|
# verify clean stop (exit code 0)
|
||||||
dockerResultStop2=$(docker inspect -f '{{ .State.ExitCode }}' \
|
dockerResultExit=$(docker inspect -f '{{ .State.ExitCode }}' \
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
||||||
elif [ "$1" = "start" ]; then
|
elif [ "$1" = "start" ]; then
|
||||||
echo -e "${op}${stamp} Starting ${2}-mailcow container...${normal}" \
|
echo -e "${op}${stamp} Starting ${2}-mailcow container...${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
docker-compose start ${2}-mailcow 2>> "$logFile"
|
docker-compose start ${2}-mailcow 2>> "$logFile"
|
||||||
# verify
|
# verify
|
||||||
dockerResult=$(docker inspect -f '{{ .State.Running }}' \
|
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -532,7 +532,7 @@ cd "$mailcowPath"
|
|||||||
## Stop postfix-mailcow container
|
## Stop postfix-mailcow container
|
||||||
operateDocker stop postfix
|
operateDocker stop postfix
|
||||||
# process result
|
# process result
|
||||||
if [ "$dockerResult" -eq 0 ]; then
|
if [ "$dockerResultState" = "False" ] && [ "$dockerResultExit" -eq 0 ]; then
|
||||||
echo -e "${info}${stamp} -- [INFO] Postfix container stopped --${normal}" \
|
echo -e "${info}${stamp} -- [INFO] Postfix container stopped --${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
else
|
else
|
||||||
@ -543,7 +543,7 @@ fi
|
|||||||
## Stop dovecot-mailcow container
|
## Stop dovecot-mailcow container
|
||||||
operateDocker stop dovecot
|
operateDocker stop dovecot
|
||||||
# process result
|
# process result
|
||||||
if [ "$dockerResult" -eq 0 ]; then
|
if [ "$dockerResultState" = "False" ] && [ "$dockerResult" -eq 0 ]; then
|
||||||
echo -e "${info}${stamp} -- [INFO] Dovecot container stopped --${normal}" \
|
echo -e "${info}${stamp} -- [INFO] Dovecot container stopped --${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user