switch to mailcow directory to allow docker cmds
This commit is contained in:
parent
2432139f3d
commit
b5247a085e
@ -119,14 +119,14 @@ doDocker() {
|
|||||||
if [ "$1" = "stop" ]; then
|
if [ "$1" = "stop" ]; then
|
||||||
printf "%s[%s] -- [INFO] Stopping %s-mailcow container --%s\n" \
|
printf "%s[%s] -- [INFO] Stopping %s-mailcow container --%s\n" \
|
||||||
"$cyan" "$(stamp)" "$2" "$norm" >> "$logFile"
|
"$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
|
# set result vars
|
||||||
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
|
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
|
||||||
dockerResultExit="$( docker inspect -f '{{ .State.ExitCode }}' $containerName )"
|
dockerResultExit="$( docker inspect -f '{{ .State.ExitCode }}' $containerName )"
|
||||||
elif [ "$1" = "start" ]; then
|
elif [ "$1" = "start" ]; then
|
||||||
printf "%s[%s] -- [INFO] Starting %s-mailcow container --%s\n" \
|
printf "%s[%s] -- [INFO] Starting %s-mailcow container --%s\n" \
|
||||||
"$cyan" "$(stamp)" "$2" "$norm" >> "$logFile"
|
"$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
|
# set result vars
|
||||||
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
|
dockerResultState="$( docker inspect -f '{{ .State.Running }}' $containerName )"
|
||||||
fi
|
fi
|
||||||
@ -592,6 +592,8 @@ if [ "$use503" -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
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
|
### stop postfix and dovecot mail containers to prevent mailflow during backup
|
||||||
doDocker stop postfix
|
doDocker stop postfix
|
||||||
@ -763,6 +765,7 @@ exit 0
|
|||||||
# 2: not run as root
|
# 2: not run as root
|
||||||
# 3: borg not installed
|
# 3: borg not installed
|
||||||
# 99: TERM signal trapped
|
# 99: TERM signal trapped
|
||||||
|
# 100: could not change to mailcow-dockerized directory
|
||||||
# 101: could not stop container(s)
|
# 101: could not stop container(s)
|
||||||
# 102: could not start container(s)
|
# 102: could not start container(s)
|
||||||
# 115: unable to create temp dir for SQL dump
|
# 115: unable to create temp dir for SQL dump
|
||||||
|
Loading…
Reference in New Issue
Block a user