Use / on end of mountpoint test in do-backup.
This commit is contained in:
parent
85ab7c4b99
commit
70443978b6
1 changed files with 10 additions and 7 deletions
17
do-backup
17
do-backup
|
|
@ -9,7 +9,8 @@
|
||||||
# Base configuration.
|
# Base configuration.
|
||||||
RSYNC_OPTIONS=( '-a' '-H' '-A' '--timeout=300' '--partial' '--partial-dir=.rsync-tmp' '--delete-delay' '--delay-updates' )
|
RSYNC_OPTIONS=( '-a' '-H' '-A' '--timeout=300' '--partial' '--partial-dir=.rsync-tmp' '--delete-delay' '--delay-updates' )
|
||||||
RSYNC_OPTIONS_VERBOSE=( '--verbose' '--stats' '--human-readable' )
|
RSYNC_OPTIONS_VERBOSE=( '--verbose' '--stats' '--human-readable' )
|
||||||
RSYNC_LOG="/tmp/${0##*/}-$$.log"
|
RSYNC_LOG="/tmp/${0##*/}-$$-$RANDOM.log"
|
||||||
|
LOCK_FILE="/tmp/${0##*/}-$$-$RANDOM.lock"
|
||||||
|
|
||||||
# Sanity checks.
|
# Sanity checks.
|
||||||
(( $# != 1 )) || [[ -z "$1" ]] || [[ "$1" =~ ^(-h|-help|--help)$ ]] && {
|
(( $# != 1 )) || [[ -z "$1" ]] || [[ "$1" =~ ^(-h|-help|--help)$ ]] && {
|
||||||
|
|
@ -17,6 +18,9 @@ RSYNC_LOG="/tmp/${0##*/}-$$.log"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove temporary files upon exit.
|
||||||
|
trap 'rm -f "$RSYNC_LOG"; rm -f "$LOCK_FILE"' EXIT
|
||||||
|
|
||||||
# Get backup definition specific configuration.
|
# Get backup definition specific configuration.
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'gv0')
|
'gv0')
|
||||||
|
|
@ -93,7 +97,8 @@ source /etc/mail.conf "backups" 2>/dev/null || {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make sure BACKUP_MOUNTPOINT is a mountpoint.
|
# Make sure BACKUP_MOUNTPOINT is a mountpoint.
|
||||||
mountpoint "$BACKUP_MOUNTPOINT" >/dev/null 2>&1 || {
|
# Note: The / on the end if required for automount mountpoints.
|
||||||
|
mountpoint "$BACKUP_MOUNTPOINT/" >/dev/null 2>&1 || {
|
||||||
[[ -x /opt/bin/pushover-client ]] && /opt/bin/pushover-client "backups" -p -1 -m "Backup failure: ${ERRORS_SOURCE:-$RSYNC_SOURCE}"
|
[[ -x /opt/bin/pushover-client ]] && /opt/bin/pushover-client "backups" -p -1 -m "Backup failure: ${ERRORS_SOURCE:-$RSYNC_SOURCE}"
|
||||||
if [[ -n "${EMAIL_TO[*]}" ]]; then
|
if [[ -n "${EMAIL_TO[*]}" ]]; then
|
||||||
mailx "${MAILX_ARGS[@]}" -S "from=$EMAIL_FROM" -s "Backup failure: ${ERRORS_SOURCE:-$RSYNC_SOURCE}" "${EMAIL_TO[@]}" <<-EOF 2>/dev/null || \
|
mailx "${MAILX_ARGS[@]}" -S "from=$EMAIL_FROM" -s "Backup failure: ${ERRORS_SOURCE:-$RSYNC_SOURCE}" "${EMAIL_TO[@]}" <<-EOF 2>/dev/null || \
|
||||||
|
|
@ -138,13 +143,11 @@ ERR="$?"
|
||||||
Output:
|
Output:
|
||||||
$(< "$RSYNC_LOG")
|
$(< "$RSYNC_LOG")
|
||||||
EOF
|
EOF
|
||||||
RET=1
|
exit 1
|
||||||
else
|
else
|
||||||
printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2
|
printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2
|
||||||
RET=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -f "$RSYNC_LOG"
|
exit 0
|
||||||
|
|
||||||
exit "${RET:-0}"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue