neb/skel/opt/scripts/restic/backup.sh

17 lines
436 B
Bash
Raw Permalink Normal View History

2023-10-18 01:31:05 +02:00
#!/bin/sh
2023-10-18 01:57:15 +02:00
ntfy() {
2023-10-20 03:43:30 +02:00
bash /opt/scripts/ntfy.sh -s "/etc/ixvd/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
2023-10-18 01:57:15 +02:00
}
2023-12-06 21:46:58 +01:00
ntfy -m "performing backup..." -p 1
2023-10-18 01:31:05 +02:00
if restic \
2023-10-18 23:04:18 +02:00
-r "/mnt/backups/restic/$(hostname)" \
2023-10-18 22:59:21 +02:00
-p "/etc/ixvd/secrets/restic/$(hostname).secret" \
2023-10-18 01:31:05 +02:00
backup \
--tag auto \
/srv /home /etc; then
2023-12-06 21:46:58 +01:00
ntfy -m "backup succeeded" -p 1
2023-10-18 01:31:05 +02:00
else
2023-10-18 23:17:28 +02:00
ntfy -m "backup failed" -e "warning,skull" -p 5
2023-10-18 01:31:05 +02:00
fi