mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-01 08:33:06 +01:00
Use send-matrix-webhook
This commit is contained in:
parent
dd4c0cbd90
commit
8077719a96
15
btrfs-backup
15
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
|
||||
|
Loading…
Reference in New Issue
Block a user