Merge pull request #1 from hockeymikey/master
Ensure non-exactly named services are found
This commit is contained in:
commit
fb8091ecce
@ -230,23 +230,26 @@ function cleanup {
|
|||||||
function operateDocker {
|
function operateDocker {
|
||||||
# determine action to take
|
# determine action to take
|
||||||
if [ "$1" = "stop" ]; then
|
if [ "$1" = "stop" ]; then
|
||||||
|
rName="$(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 }}' \
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
$rName)
|
||||||
# verify clean stop (exit code 0)
|
# verify clean stop (exit code 0)
|
||||||
dockerResultExit=$(docker inspect -f '{{ .State.ExitCode }}' \
|
dockerResultExit=$(docker inspect -f '{{ .State.ExitCode }}' \
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
$rName)
|
||||||
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
|
||||||
|
rName="$(docker ps --format '{{.Names}}' --filter name=${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)"
|
||||||
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
|
dockerResultState=$(docker inspect -f '{{ .State.Running }}' \
|
||||||
${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
$rName)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user