Compare commits
No commits in common. "4aae61f97ecbaca55293d658973540af47d64bc7" and "16f4c11f911fb2ec68c0a0995802d682fd71c043" have entirely different histories.
4aae61f97e
...
16f4c11f91
@ -20,9 +20,6 @@
|
|||||||
# default is "$HOME" or "~$USER" in that order. If you're unsure, try "$HOME"
|
# default is "$HOME" or "~$USER" in that order. If you're unsure, try "$HOME"
|
||||||
borgBaseDir="/var/borgbackup"
|
borgBaseDir="/var/borgbackup"
|
||||||
|
|
||||||
# SSH port on which your borg server listens. By default, this is port 22.
|
|
||||||
borgSSHPort = 22
|
|
||||||
|
|
||||||
# full path to the SSH key used to connect to your remote backup server
|
# full path to the SSH key used to connect to your remote backup server
|
||||||
borgSSHKey="/var/borgbackup/private.key"
|
borgSSHKey="/var/borgbackup/private.key"
|
||||||
|
|
||||||
|
@ -153,10 +153,6 @@ scriptHelp() {
|
|||||||
newline
|
newline
|
||||||
textblock "${magenta}--- script related parameters ---${norm}"
|
textblock "${magenta}--- script related parameters ---${norm}"
|
||||||
newline
|
newline
|
||||||
switchTextblock "-b | --borg"
|
|
||||||
textblock "FULL path to borg executable file if not in the default location."
|
|
||||||
defaultsTextblock "(/usr/bin/borg)"
|
|
||||||
newline
|
|
||||||
switchTextblock "-c | --config | --details"
|
switchTextblock "-c | --config | --details"
|
||||||
textblock "Path to the configuration key/value-pair file for this script."
|
textblock "Path to the configuration key/value-pair file for this script."
|
||||||
defaultsTextblock "(scriptPath/scriptName.details)"
|
defaultsTextblock "(scriptPath/scriptName.details)"
|
||||||
@ -168,10 +164,6 @@ scriptHelp() {
|
|||||||
textblock "Path to write log file"
|
textblock "Path to write log file"
|
||||||
defaultsTextblock "(scriptPath/scriptName.log)"
|
defaultsTextblock "(scriptPath/scriptName.log)"
|
||||||
newline
|
newline
|
||||||
switchTextblock "[SWITCH] --nc | --no-color | --no-colour"
|
|
||||||
textblock "Do NOT use ANSI colourization in the log file (in case your preferred log viewer does not support it)."
|
|
||||||
defaultsTextblock "(use ANSI colourization to make log file look good)"
|
|
||||||
newline
|
|
||||||
switchTextblock "--compression"
|
switchTextblock "--compression"
|
||||||
textblock "Compression algorithm(s) that borg should use. Please run 'borg help compression' for details."
|
textblock "Compression algorithm(s) that borg should use. Please run 'borg help compression' for details."
|
||||||
defaultsTextblock "(not specified, use borg default of lz4)"
|
defaultsTextblock "(not specified, use borg default of lz4)"
|
||||||
@ -260,13 +252,11 @@ trapExit() {
|
|||||||
scriptPath="$( CDPATH='' cd -- "$( dirname -- "$0" )" && pwd -P )"
|
scriptPath="$( CDPATH='' cd -- "$( dirname -- "$0" )" && pwd -P )"
|
||||||
scriptName="$( basename "$0" )"
|
scriptName="$( basename "$0" )"
|
||||||
logFile="$scriptPath/${scriptName%.*}.log"
|
logFile="$scriptPath/${scriptName%.*}.log"
|
||||||
colourizeLogFile=1
|
|
||||||
warnCount=0
|
warnCount=0
|
||||||
configDetails="$scriptPath/${scriptName%.*}.details"
|
configDetails="$scriptPath/${scriptName%.*}.details"
|
||||||
err503Copied=0
|
err503Copied=0
|
||||||
sqlDumpDirCreated=0
|
sqlDumpDirCreated=0
|
||||||
exclusions=0
|
exclusions=0
|
||||||
borgPath="/usr/bin/borg"
|
|
||||||
# borg output verbosity -- normal
|
# borg output verbosity -- normal
|
||||||
borgCreateParams='--stats'
|
borgCreateParams='--stats'
|
||||||
borgPruneParams='--list'
|
borgPruneParams='--list'
|
||||||
@ -301,19 +291,6 @@ while [ $# -gt 0 ]; do
|
|||||||
badParam empty "$@"
|
badParam empty "$@"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--nc|--no-color|--no-colour)
|
|
||||||
# do NOT colourize log file
|
|
||||||
colourizeLogFile=0
|
|
||||||
;;
|
|
||||||
-b|--borg)
|
|
||||||
# specify non-default borg path
|
|
||||||
if [ -n "$2" ]; then
|
|
||||||
borgPath="${2%/}"
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
badParam empty "$@"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
-c|--config|--details)
|
-c|--config|--details)
|
||||||
# location of config details file
|
# location of config details file
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
@ -435,8 +412,8 @@ if [ ! -f "$configDetails" ]; then
|
|||||||
badParam dne "(--details default)" "$configDetails"
|
badParam dne "(--details default)" "$configDetails"
|
||||||
fi
|
fi
|
||||||
# is borg installed?
|
# is borg installed?
|
||||||
if ! find "$borgPath" -type f -executable > /dev/null 2>&1; then
|
if ! command -v borg > /dev/null; then
|
||||||
printf "\n%sERROR: BORG cannot be found in the specified or default location on this system!%s\n\n" "$err" "$norm"
|
printf "\n%sERROR: BORG is not installed on this system!%s\n\n" "$err" "$norm"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
# if 503 functionality is enabled, do 503 related files exist?
|
# if 503 functionality is enabled, do 503 related files exist?
|
||||||
@ -459,17 +436,6 @@ fi
|
|||||||
if [ -n "$borgCompression" ]; then
|
if [ -n "$borgCompression" ]; then
|
||||||
borgCreateParams="${borgCreateParams} --compression ${borgCompression}"
|
borgCreateParams="${borgCreateParams} --compression ${borgCompression}"
|
||||||
fi
|
fi
|
||||||
# remove colourization if parameter specified
|
|
||||||
if [ "$colourizeLogFile" -eq 0 ]; then
|
|
||||||
bold=""
|
|
||||||
cyan=""
|
|
||||||
err=""
|
|
||||||
magenta=""
|
|
||||||
norm=""
|
|
||||||
ok=""
|
|
||||||
warn=""
|
|
||||||
yellow=""
|
|
||||||
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
|
||||||
@ -543,16 +509,7 @@ elif [ ! -f "${borgSSHKey}" ]; then
|
|||||||
fi
|
fi
|
||||||
printf "%sdetails:borgSSHKey %s-- %s[OK]%s\n" \
|
printf "%sdetails:borgSSHKey %s-- %s[OK]%s\n" \
|
||||||
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
|
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
|
||||||
## check SSH port
|
export BORG_RSH="ssh -i ${borgSSHKey}"
|
||||||
if [ -z "${borgSSHPort}" ]; then
|
|
||||||
borgSSHPort=22
|
|
||||||
printf "%sdetails:borgSSHPort %s-- %s[DEFAULT]%s\n" \
|
|
||||||
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
|
|
||||||
else
|
|
||||||
printf "%sdetails:borgSSHPort %s-- %s[CUSTOM]%s\n" \
|
|
||||||
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
|
|
||||||
fi
|
|
||||||
export BORG_RSH="ssh -i ${borgSSHKey} -p ${borgSSHPort}"
|
|
||||||
|
|
||||||
## check borg repo connect string
|
## check borg repo connect string
|
||||||
if [ -z "${borgConnectRepo}" ]; then
|
if [ -z "${borgConnectRepo}" ]; then
|
||||||
@ -733,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="${borgPath} create --show-rc ${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} \
|
||||||
@ -744,7 +701,7 @@ if [ "$exclusions" -eq 0 ]; then
|
|||||||
${dockerVolumeCrypt} \
|
${dockerVolumeCrypt} \
|
||||||
${xtraList}"
|
${xtraList}"
|
||||||
elif [ "$exclusions" -eq 1 ]; then
|
elif [ "$exclusions" -eq 1 ]; then
|
||||||
borgCMD="${borgPath} create --show-rc ${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%/*} \
|
||||||
@ -788,7 +745,7 @@ fi
|
|||||||
if [ -n "${borgPruneSettings}" ]; then
|
if [ -n "${borgPruneSettings}" ]; then
|
||||||
printf "%s[%s] -- [INFO] Executing borg prune operation --%s\n" \
|
printf "%s[%s] -- [INFO] Executing borg prune operation --%s\n" \
|
||||||
"$cyan" "$(stamp)" "$norm" >> "$logFile"
|
"$cyan" "$(stamp)" "$norm" >> "$logFile"
|
||||||
"${borgPath}" prune --show-rc -v ${borgPruneParams} ${borgPruneSettings} \
|
borg prune --show-rc -v ${borgPruneParams} ${borgPruneSettings} \
|
||||||
2>> "$logFile"
|
2>> "$logFile"
|
||||||
borgPruneResult="$?"
|
borgPruneResult="$?"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user