Use send-matrix-webhook

This commit is contained in:
Jeffrey Serio 2023-12-06 14:15:47 -06:00
parent dd4c0cbd90
commit 8077719a96

View File

@ -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