added check for container stop AND exit code in fcn operateDocker stop

This commit is contained in:
Asif Bacchus 2018-10-25 04:22:57 -06:00
parent 292dc3c1b8
commit c03eecc1d3

View File

@ -221,8 +221,12 @@ if [ "$1" = "stop" ]; then
>> "$logFile" >> "$logFile"
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \ docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
2>> "$logFile" 2>> "$logFile"
# verify # verify container stopped (should return true)
dockerResult=$(docker inspect -f '{{ .State.ExitCode }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1) dockerResultStop1=$(docker inspect -f '{{ .State.Running }}' \
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
# verify clean stop (exit code 0)
dockerResultStop2=$(docker inspect -f '{{ .State.ExitCode }}' \
${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"