Compare commits

...

3 Commits

Author SHA1 Message Date
Asif Bacchus
5f0eddf22a add mailcow.conf location in docker-compose cmds 2020-05-07 01:00:14 -06:00
Asif Bacchus
09c1d903ba move sql dump earlier in script
Borg requires the default TMP dir be changed to avoid permissions issue.
Moving earlier means SQL dumps to system default TMP location.
2020-05-07 00:58:27 -06:00
Asif Bacchus
51928d4327 fix error in default docker-compose location 2020-05-07 00:47:34 -06:00

View File

@ -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" stop --timeout "$dockerStopTimeout" "$2-mailcow" 2>> "$logFile" docker-compose -f "$mcDockerCompose" --env-path "$mcConfig" 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" start "$2-mailcow" 2>> "$logFile" docker-compose -f "$mcDockerCompose" --env-path "$mcConfig" 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
@ -246,7 +246,7 @@ webroot="/usr/share/nginx/html"
# mailcow/docker related # mailcow/docker related
mcConfig='/opt/mailcow-dockerized/mailcow.conf' mcConfig='/opt/mailcow-dockerized/mailcow.conf'
mcDockerCompose="${mcConfig}/docker-compose.yml" mcDockerCompose="${mcConfig%/*}/docker-compose.yml"
dockerStartTimeout=180 dockerStartTimeout=180
dockerStopTimeout=120 dockerStopTimeout=120
@ -545,6 +545,18 @@ exclusions=1
fi fi
### set location of sql dump
# this is done before resetting default TMP dir for borg
if ! sqlDumpDir=$( mktemp -d 2>/dev/null ); then
exitError 115 'Unable to create temp directory for SQL dump.'
else
sqlDumpFile="backup-$( date +%Y%m%d_%H%M%S ).sql"
sqlDumpDirCreated=1
printf "%s[%s] -- [INFO] SQL dump file will be stored at: %s --%s\n" \
"$cyan" "$(stamp)" "$sqlDumpDir/$sqlDumpFile" "$norm" >> "$logFile"
fi
### create borg temp dir: ### create borg temp dir:
## python requires a writable temporary directory when unpacking borg and ## python requires a writable temporary directory when unpacking borg and
## executing commands. This defaults to /tmp but many systems mount /tmp with ## executing commands. This defaults to /tmp but many systems mount /tmp with
@ -564,17 +576,6 @@ fi
export TMPDIR="${borgBaseDir}/tmp" export TMPDIR="${borgBaseDir}/tmp"
### set location of sql dump
if ! sqlDumpDir=$( mktemp -d 2>/dev/null ); then
exitError 115 'Unable to create temp directory for SQL dump.'
else
sqlDumpFile="backup-$( date +%Y%m%d_%H%M%S ).sql"
sqlDumpDirCreated=1
printf "%s[%s] -- [INFO] SQL dump file will be stored at: %s --%s\n" \
"$cyan" "$(stamp)" "$sqlDumpDir/$sqlDumpFile" "$norm" >> "$logFile"
fi
### 503 functionality ### 503 functionality
if [ "$use503" -eq 1 ]; then if [ "$use503" -eq 1 ]; then
printf "%s[%s] -- [INFO] Copying 503 error page to " \ printf "%s[%s] -- [INFO] Copying 503 error page to " \