Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2231c7074 | |||
| 2747b10040 | |||
| 876f8eee9e | |||
| 3a3b02685b | |||
| 85e34c73a3 | |||
| 9e592633b9 | |||
| e127616800 |
+22
-4
@@ -164,6 +164,10 @@ scriptHelp() {
|
|||||||
textblock "Path to write log file"
|
textblock "Path to write log file"
|
||||||
defaultsTextblock "(scriptPath/scriptName.log)"
|
defaultsTextblock "(scriptPath/scriptName.log)"
|
||||||
newline
|
newline
|
||||||
|
switchTextblock "--compression"
|
||||||
|
textblock "Compression algorithm(s) that borg should use. Please run 'borg help compression' for details."
|
||||||
|
defaultsTextblock "(not specified, use borg default of lz4)"
|
||||||
|
newline
|
||||||
switchTextblock "[SWITCH] -v | --verbose"
|
switchTextblock "[SWITCH] -v | --verbose"
|
||||||
textblock "Log borg output with increased verbosity (list all files). Careful! Your log file can get very large very quickly!"
|
textblock "Log borg output with increased verbosity (list all files). Careful! Your log file can get very large very quickly!"
|
||||||
defaultsTextblock "(normal output, option is OFF)"
|
defaultsTextblock "(normal output, option is OFF)"
|
||||||
@@ -300,6 +304,15 @@ while [ $# -gt 0 ]; do
|
|||||||
badParam empty "$@"
|
badParam empty "$@"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--compression)
|
||||||
|
# set borg archive compression
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
borgCompression="$2"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
badParam empty "$@"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
-v|--verbose)
|
-v|--verbose)
|
||||||
# set verbose logging from borg
|
# set verbose logging from borg
|
||||||
borgCreateParams='--list --stats'
|
borgCreateParams='--list --stats'
|
||||||
@@ -367,6 +380,7 @@ while [ $# -gt 0 ]; do
|
|||||||
badParam empty "$@"
|
badParam empty "$@"
|
||||||
else
|
else
|
||||||
dockerStartTimeout="$2"
|
dockerStartTimeout="$2"
|
||||||
|
shift
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
-t2|--timeout-stop)
|
-t2|--timeout-stop)
|
||||||
@@ -374,6 +388,7 @@ while [ $# -gt 0 ]; do
|
|||||||
badParam empty "$@"
|
badParam empty "$@"
|
||||||
else
|
else
|
||||||
dockerStopTimeout="$2"
|
dockerStopTimeout="$2"
|
||||||
|
shift
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -417,7 +432,10 @@ fi
|
|||||||
if [ ! -f "$mcDockerCompose" ]; then
|
if [ ! -f "$mcDockerCompose" ]; then
|
||||||
badParam dne "(--docker-compose)" "$mcDockerCompose"
|
badParam dne "(--docker-compose)" "$mcDockerCompose"
|
||||||
fi
|
fi
|
||||||
|
# set compression level if specified
|
||||||
|
if [ -n "$borgCompression" ]; then
|
||||||
|
borgCreateParams="${borgCreateParams} --compression ${borgCompression}"
|
||||||
|
fi
|
||||||
|
|
||||||
### read mailcow.conf and set vars as needed
|
### read mailcow.conf and set vars as needed
|
||||||
# shellcheck source=./mailcow.conf.shellcheck
|
# shellcheck source=./mailcow.conf.shellcheck
|
||||||
@@ -615,7 +633,7 @@ if [ "$use503" -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### change to mailcow directory so docker commands execute properly
|
### change to mailcow directory so docker commands execute properly
|
||||||
cd "${mcConfig%/*}" || exitError 100 'Could not change to mailcow directory.'
|
\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
|
||||||
@@ -672,7 +690,7 @@ printf "%s[%s] -- [INFO] Pre-backup tasks completed, calling borgbackup --%s\n"
|
|||||||
## construct the proper borg commandline
|
## construct the proper borg commandline
|
||||||
# base command
|
# base command
|
||||||
if [ "$exclusions" -eq 0 ]; then
|
if [ "$exclusions" -eq 0 ]; then
|
||||||
borgCMD="borg --show-rc create ${borgCreateParams} \
|
borgCMD="borg create --show-rc ${borgCreateParams} \
|
||||||
::$(date +%Y-%m-%d_%H%M%S) \
|
::$(date +%Y-%m-%d_%H%M%S) \
|
||||||
${mcConfig%/*} \
|
${mcConfig%/*} \
|
||||||
${sqlDumpDir} \
|
${sqlDumpDir} \
|
||||||
@@ -683,7 +701,7 @@ if [ "$exclusions" -eq 0 ]; then
|
|||||||
${dockerVolumeCrypt} \
|
${dockerVolumeCrypt} \
|
||||||
${xtraList}"
|
${xtraList}"
|
||||||
elif [ "$exclusions" -eq 1 ]; then
|
elif [ "$exclusions" -eq 1 ]; then
|
||||||
borgCMD="borg --show-rc create ${borgCreateParams} \
|
borgCMD="borg create --show-rc ${borgCreateParams} \
|
||||||
--exclude-from ${borgExcludeListPath} \
|
--exclude-from ${borgExcludeListPath} \
|
||||||
::$(date +%Y-%m-%d_%H%M%S) \
|
::$(date +%Y-%m-%d_%H%M%S) \
|
||||||
${mcConfig%/*} \
|
${mcConfig%/*} \
|
||||||
|
|||||||
Regular → Executable
+1
-4
@@ -57,7 +57,7 @@ doRestore() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if (! (cd "$sourceFiles/_data" && tar -cf - .) | (cd "${3}" && tar xvf -) > /dev/null 2>&1 ); then
|
if (! (cd "$sourceFiles/_data" && tar -cf - .) | (cd "${2}" && tar xvf -) > /dev/null 2>&1 ); then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
@@ -500,7 +500,6 @@ if [ "$restorePostfix" -eq 1 ]; then
|
|||||||
writeLog 'task' "Restoring postfix files"
|
writeLog 'task' "Restoring postfix files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# restore email messages
|
|
||||||
doRestore "${COMPOSE_PROJECT_NAME}_postfix-vol-1" "$dockerVolumePostfix"; ec="$?"
|
doRestore "${COMPOSE_PROJECT_NAME}_postfix-vol-1" "$dockerVolumePostfix"; ec="$?"
|
||||||
case "$ec" in
|
case "$ec" in
|
||||||
0)
|
0)
|
||||||
@@ -537,7 +536,6 @@ if [ "$restoreRspamd" -eq 1 ]; then
|
|||||||
writeLog 'task' "Restoring Rspamd files"
|
writeLog 'task' "Restoring Rspamd files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# restore email messages
|
|
||||||
doRestore "${COMPOSE_PROJECT_NAME}_rspamd-vol-1" "$dockerVolumeRspamd"; ec="$?"
|
doRestore "${COMPOSE_PROJECT_NAME}_rspamd-vol-1" "$dockerVolumeRspamd"; ec="$?"
|
||||||
case "$ec" in
|
case "$ec" in
|
||||||
0)
|
0)
|
||||||
@@ -574,7 +572,6 @@ if [ "$restoreRedis" -eq 1 ]; then
|
|||||||
writeLog 'task' "Restoring redis database"
|
writeLog 'task' "Restoring redis database"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# restore email messages
|
|
||||||
doRestore "${COMPOSE_PROJECT_NAME}_redis-vol-1" "$dockerVolumeRedis"; ec="$?"
|
doRestore "${COMPOSE_PROJECT_NAME}_redis-vol-1" "$dockerVolumeRedis"; ec="$?"
|
||||||
case "$ec" in
|
case "$ec" in
|
||||||
0)
|
0)
|
||||||
|
|||||||
Reference in New Issue
Block a user