No backup failure notification

Henry

Member
Jan 1, 2016
83
0
6
52
I receive an email notification when a backup succeeds but not when it fails, I have notification set to always.

The hook script mounts the external USB hdd with a label corresponding to the day of week. The following is logged to the console:

INFO: starting new backup job: vzdump --compress lzo --node pve --mode snapshot --all 1 --mailnotification always --storage external-hdd --mailto support@mydomain.com --quiet 1 --script /root/backup-ext.sh
INFO: mount: can't find LABEL="sunday"
INFO: Failed to mount external backup hard disk
INFO: umount: /mnt/external-hdd/: not mounted
INFO: Backup aborted
INFO: Unmounted external backup hard disk
TASK ERROR: command '/root/backup-ext.sh job-abort' failed: exit code 1


The backup-ext.sh script is as follows:

root@pve:~# cat /root/backup-ext.sh
#!/bin/bash

WeekDay=$(date +%A |tr [A-Z] [a-z])

if [ "$1" == "job-start" ]; then
mount -L $WeekDay /mnt/external-hdd/
if mountpoint -q /mnt/external-hdd; then
echo "External backup hard drive successfully mounted"
exit 0
else
echo "Failed to mount external backup hard disk"
exit 1
fi
fi

if [[ "$1" == "job-end" ]]; then
umount /mnt/external-hdd/
echo "Backup completed"
echo "Unmounted external backup hard disk"
exit 0
fi

if [[ "$1" == "job-abort" ]]; then
umount /mnt/external-hdd/
echo "Backup aborted"
echo "Unmounted external backup hard disk"
exit 1
fi
 
hi,

why do you exit with 1 in the job-abort section?
this causes the subroutine to end, because it sees that the script exits with an error