Compare commits

...

2 Commits

Author SHA1 Message Date
Asif Bacchus
b5247a085e switch to mailcow directory to allow docker cmds 2020-05-07 01:10:26 -06:00
Asif Bacchus
2432139f3d simplify mcConfig existance check 2020-05-07 01:08:36 -06:00

View File

@ -119,14 +119,14 @@ doDocker() {
if [ "$1" = "stop" ]; then
printf "%s[%s] -- [INFO] Stopping %s-mailcow container --%s\n" \
"$cyan" "$(stamp)" "$2" "$norm" >> "$logFile"
docker-compose -f "$mcDockerCompose" --env-path "$mcConfig" stop --timeout "$dockerStopTimeout" "$2-mailcow" 2>> "$logFile"
docker-compose -f "$mcDockerCompose" stop --timeout "$dockerStopTimeout" "$2-mailcow" 2>> "$logFile"
# set result vars
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
dockerResultExit="$( docker inspect -f '{{ .State.ExitCode }}' $containerName )"
elif [ "$1" = "start" ]; then
printf "%s[%s] -- [INFO] Starting %s-mailcow container --%s\n" \
"$cyan" "$(stamp)" "$2" "$norm" >> "$logFile"
docker-compose -f "$mcDockerCompose" --env-path "$mcConfig" start "$2-mailcow" 2>> "$logFile"
docker-compose -f "$mcDockerCompose" start "$2-mailcow" 2>> "$logFile"
# set result vars
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
fi
@ -391,10 +391,7 @@ if [ "$use503" -eq 1 ]; then
fi
fi
# verify mailcow.conf location and extract path
if [ -f "$mcConfig" ]; then
# strip filename and get path
mcPath=${mcConfig%/*/}
else
if [ ! -f "$mcConfig" ]; then
badParam dne "(--mailcow-config)" "$mcConfig"
fi
# verify docker-compose file exists
@ -595,6 +592,8 @@ if [ "$use503" -eq 1 ]; then
fi
fi
### change to mailcow directory so docker commands execute properly
cd "${mcConfig%/*}" || exitError 100 'Could not change to mailcow directory.'
### stop postfix and dovecot mail containers to prevent mailflow during backup
doDocker stop postfix
@ -766,6 +765,7 @@ exit 0
# 2: not run as root
# 3: borg not installed
# 99: TERM signal trapped
# 100: could not change to mailcow-dockerized directory
# 101: could not stop container(s)
# 102: could not start container(s)
# 115: unable to create temp dir for SQL dump