Container stop section using operateDocker function
This commit is contained in:
parent
0b4dd79ea1
commit
9e590bba0f
@ -187,11 +187,13 @@ if [ "$1" = "stop" ]; then
|
|||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
|
docker-compose stop --timeout ${dockerStopTimeout} ${2}-mailcow \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
|
# verify
|
||||||
dockerResult=$(docker inspect -f '{{ .State.ExitCode }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
dockerResult=$(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"
|
||||||
docker-compose start ${2}-mailcow >> "$logFile"
|
docker-compose start ${2}-mailcow >> "$logFile"
|
||||||
|
# verify
|
||||||
dockerResult=$(docker inspect -f '{{ .State.Running }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
dockerResult=$(docker inspect -f '{{ .State.Running }}' ${COMPOSE_PROJECT_NAME}_${2}-mailcow_1)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -480,14 +482,12 @@ fi
|
|||||||
### Change directory to mailcowPath
|
### Change directory to mailcowPath
|
||||||
cd "$mailcowPath"
|
cd "$mailcowPath"
|
||||||
|
|
||||||
|
|
||||||
### Stop postfix and dovecot so mailflow is stopped until backup is completed
|
### Stop postfix and dovecot so mailflow is stopped until backup is completed
|
||||||
## Stop postfix-mailcow container
|
## Stop postfix-mailcow container
|
||||||
echo -e "${op}${stamp} Stopping postfix-mailcow container...${normal}" \
|
operateDocker stop postfix
|
||||||
>> "$logFile"
|
# process result
|
||||||
docker-compose stop --timeout ${dockerStopTimeout} postfix-mailcow >> "$logFile"
|
if [ "$dockerResult" -eq 0 ]; then
|
||||||
# verify stop was successful
|
|
||||||
checkResult=$(docker inspect -f '{{ .State.ExitCode }}' ${COMPOSE_PROJECT_NAME}_postfix-mailcow_1)
|
|
||||||
if [ "$checkResult" -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
|
||||||
@ -496,12 +496,9 @@ else
|
|||||||
quit
|
quit
|
||||||
fi
|
fi
|
||||||
## Stop dovecot-mailcow container
|
## Stop dovecot-mailcow container
|
||||||
echo -e "${op}${stamp} Stopping dovecot-mailcow container...${normal}" \
|
operateDocker stop dovecot
|
||||||
>> "$logFile"
|
# process result
|
||||||
docker-compose stop --timeout ${dockerStopTimeout} dovecot-mailcow >> "$logFile"
|
if [ "$dockerResult" -eq 0 ]; then
|
||||||
# verify stop was successful
|
|
||||||
checkResult=$(docker inspect -f '{{ .State.ExitCode }}' ${COMPOSE_PROJECT_NAME}_dovecot-mailcow_1)
|
|
||||||
if [ "$checkResult" -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