added local.pre and local.post hooks, fixed error when HEALTHCHECK_URL was unset

This commit is contained in:
Alexander Rust 2017-09-08 13:49:08 +02:00
parent 38ef0633f8
commit 3dd69be90c

View file

@ -59,9 +59,18 @@ do_local_backup () {
fi fi
. /etc/backup/local.config . /etc/backup/local.config
if [[ -x /etc/backup/local.pre ]]; then
/etc/backup/local.pre $TARGET
fi
$RESTIC --exclude-file /etc/backup/local.exclude backup --hostname $BACKUP_HOSTNAME $BACKUP_DIR $RESTIC --exclude-file /etc/backup/local.exclude backup --hostname $BACKUP_HOSTNAME $BACKUP_DIR
if [ -n "$HEALTHCHECK_URL" ]; then if [[ -x /etc/backup/local.post ]]; then
/etc/backup/local.post $TARGET
fi
if [[ -n "${HEALTHCHECK_URL:-}" ]]; then
if [[ -x $CURL ]]; then if [[ -x $CURL ]]; then
$CURL -fsS --retry 4 "$HEALTHCHECK_URL" > /dev/null $CURL -fsS --retry 4 "$HEALTHCHECK_URL" > /dev/null
fi fi