From 3dd69be90c1946089c81cdc5dd83659bd56062af Mon Sep 17 00:00:00 2001 From: Alexander Rust Date: Fri, 8 Sep 2017 13:49:08 +0200 Subject: [PATCH] added local.pre and local.post hooks, fixed error when HEALTHCHECK_URL was unset --- bin/backup | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/backup b/bin/backup index 8eefedf..c540ad4 100755 --- a/bin/backup +++ b/bin/backup @@ -59,9 +59,18 @@ do_local_backup () { fi . /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 - 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 $CURL -fsS --retry 4 "$HEALTHCHECK_URL" > /dev/null fi