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.
|
||||
RSYNC_OPTIONS=( '-a' '-H' '-A' '--timeout=300' '--partial' '--partial-dir=.rsync-tmp' '--delete-delay' '--delay-updates' )
|
||||
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.
|
||||
(( $# != 1 )) || [[ -z "$1" ]] || [[ "$1" =~ ^(-h|-help|--help)$ ]] && {
|
||||
|
|
@ -17,6 +18,9 @@ RSYNC_LOG="/tmp/${0##*/}-$$.log"
|
|||
exit 1
|
||||
}
|
||||
|
||||
# Remove temporary files upon exit.
|
||||
trap 'rm -f "$RSYNC_LOG"; rm -f "$LOCK_FILE"' EXIT
|
||||
|
||||
# Get backup definition specific configuration.
|
||||
case "$1" in
|
||||
'gv0')
|
||||
|
|
@ -93,7 +97,8 @@ source /etc/mail.conf "backups" 2>/dev/null || {
|
|||
}
|
||||
|
||||
# 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}"
|
||||
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 || \
|
||||
|
|
@ -138,13 +143,11 @@ ERR="$?"
|
|||
Output:
|
||||
$(< "$RSYNC_LOG")
|
||||
EOF
|
||||
RET=1
|
||||
exit 1
|
||||
else
|
||||
printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2
|
||||
RET=1
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
rm -f "$RSYNC_LOG"
|
||||
|
||||
exit "${RET:-0}"
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue