From 8077719a966069a13cebe2ce7b7d5a37ab619ed5 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Wed, 6 Dec 2023 14:15:47 -0600 Subject: [PATCH] Use send-matrix-webhook --- btrfs-backup | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/btrfs-backup b/btrfs-backup index 7f0583b..1e8cc4e 100755 --- a/btrfs-backup +++ b/btrfs-backup @@ -2,7 +2,12 @@ LOGFILE="/var/log/btrfs-backup.log" SNAP_DATE=$(date '+%Y-%m-%d_%H%M%S') -HEALTHCHECKS_URL="" + +send_matrix_webhook() { + /usr/local/bin/send-matrix-webhook "btrfs-backup failed on $(hostname)" +} + +trap send_matrix_webhook SIGINT SIGTERM EXIT # Check if device is mounted if ! grep "/srv/backup" /etc/mtab >/dev/null; then @@ -39,11 +44,3 @@ create_snapshot "/home" "home" # Send root and home snapshots send_snapshot "/" "root" send_snapshot "/home" "home" - -if ! curl -m 10 --retry 5 "$HEALTHCHECKS_URL"; then - echo "[$(date '+%Y-%m-%d %H:%M:%S')] Error sending ping to healthchecks.io" | tee -a "$LOGFILE" - notify-send -i computer-fail "Error sending ping to healthchecks.io" - exit 1 -else - echo "[$(date '+%Y-%m-%d %H:%M:%S')] Send ping to healthchecks.io: OK" -fi