Compare commits

..

No commits in common. "b371e18ab0fedaf192f8148d40f5adc354f7bb94" and "3ddc2c5d4a4b419dbc8e0f92341429f37a27eded" have entirely different histories.

View File

@ -230,26 +230,23 @@ function cleanup {
function operateDocker { function operateDocker {
# determine action to take # determine action to take
if [ "$1" = "stop" ]; then if [ "$1" = "stop" ]; then
containerName="$(docker ps --format '{{.Names}}' --filter name=${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)"
echo -e "${op}[$(stamp)] Stopping ${2}-mailcow container...${normal}" \ echo -e "${op}[$(stamp)] Stopping ${2}-mailcow container...${normal}" \
>> "$logFile" >> "$logFile"
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)
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \ dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
$containerName) ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
# verify clean stop (exit code 0) # verify clean stop (exit code 0)
dockerResultExit=$(docker inspect -f '{{ .State.ExitCode }}' \ dockerResultExit=$(docker inspect -f '{{ .State.ExitCode }}' \
$containerName) ${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
containerName="$(docker ps --format '{{.Names}}' --filter name=${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)"
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \ dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
$containerName) ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
fi fi
} }
@ -260,7 +257,7 @@ fi
# store the logfile in the same directory as this script using the script's name # store the logfile in the same directory as this script using the script's name
# with the extension .log # with the extension .log
scriptPath="$( cd "$( dicontainerName "${BASH_SOURCE[0]}" )" && pwd )" scriptPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
scriptName="$( basename ${0} )" scriptName="$( basename ${0} )"
logFile="$scriptPath/${scriptName%.*}.log" logFile="$scriptPath/${scriptName%.*}.log"