Can a backup hook script exit from the backup?

holckj

Active Member
Feb 14, 2021
41
2
28
69
Denmark
Each night I make a backup from Proxmox to an external HD. With a backup hook script I can check if the external HD is mounted, before the backup job is run. But can I also, in the hook script, prevent the upcoming backup if the HD is not mounted?

Jesper, Denmark
 
hi,

With a backup hook script I can check if the external HD is mounted, before the backup job is run. But can I also, in the hook script, prevent the upcoming backup if the HD is not mounted?
probably you can add a condition in your script to do an early abort.

you can show us your script if you need help
 
you could try something like this:
Code:
#!/usr/bin/env bash
grep -qs /mnt/backupdisk /proc/mounts
if [ $? -ne 0 ]; then
    # skip backup
    echo "skipping because mountpoint doesn't exist...";
    exit;
else
    # continue
    echo "everything normal";
fi
 
Last edited: