created function operateDocker for container start and stop
This commit is contained in:
parent
912f8c274a
commit
055dba2152
@ -179,6 +179,23 @@ function cleanup {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### operate docker containers
|
||||||
|
function operateDocker {
|
||||||
|
# determine action to take
|
||||||
|
if [ "$1" = "stop" ]; then
|
||||||
|
echo -e "${op}${stamp} Stopping ${2}-mailcow container...${normal}" \
|
||||||
|
>> "$logFile"
|
||||||
|
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
|
||||||
|
>> "$logFile"
|
||||||
|
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 >> "$logFile"
|
||||||
|
dockerResult=$(docker inspect -f '{{ .State.Running }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
### End of Functions ###
|
### End of Functions ###
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user