stop containers before backup starts

This commit is contained in:
Asif Bacchus 2020-05-06 23:38:26 -06:00
parent 9d7b7e1a94
commit 992f8ef16e
2 changed files with 18 additions and 1 deletions

View File

@ -12,7 +12,7 @@
-1, -1,
-1, -1,
-1, -1,
580 582
] ]
} }
] ]

View File

@ -580,6 +580,22 @@ if [ "$use503" -eq 1 ]; then
fi fi
### stop postfix and dovecot mail containers to prevent mailflow during backup
doDocker stop postfix
if [ "$dockerResultState" = "false" ] && [ "$dockerResultExit" -eq 0 ]; then
printf "%s[%s] -- [INFO] POSTFIX container stopped --$s\n" \
"$cyan" "$(stamp)" "$norm" >> "$logFile"
else
exitError 101 'Could not stop POSTFIX container.'
fi
doDocker stop dovecot
if [ "$dockerResultState" = "false" ] && [ "$dockerResultExit" -eq 0 ]; then
printf "%s[%s] -- [INFO] POSTFIX container stopped --$s\n" \
"$cyan" "$(stamp)" "$norm" >> "$logFile"
else
exitError 101 'Could not stop DOVECOT container.'
fi
### execute borg depending on whether exclusions are defined ### execute borg depending on whether exclusions are defined
## construct the proper borg commandline ## construct the proper borg commandline
@ -688,6 +704,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
# 101: could not stop container(s)
# 115: unable to create temp dir for SQL dump # 115: unable to create temp dir for SQL dump
# 130: null configuration variable in details file # 130: null configuration variable in details file
# 131: invalid configuration variable in details file # 131: invalid configuration variable in details file