neb/skel/opt/restic/backup.sh

17 lines
414 B
Bash
Raw Normal View History

2023-10-18 01:31:05 +02:00
#!/bin/sh
2023-10-18 01:57:15 +02:00
ntfy() {
sh /opt/ixvd/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
2023-10-18 01:57:15 +02:00
}
ntfy -m "performing backup..."
2023-10-18 01:31:05 +02:00
if restic \
2023-10-18 18:07:29 +02:00
-r "sftp://ixvd_backup_storage//$(hostname)" \
2023-10-18 01:31:05 +02:00
-p "/neb/secrets/restic/$(hostname).secret" \
backup \
--tag auto \
/srv /home /etc; then
2023-10-18 01:57:15 +02:00
ntfy -m "backup succeeded"
2023-10-18 01:31:05 +02:00
else
2023-10-18 01:57:15 +02:00
ntfy -m "backup failed" -e "warning,skull"
2023-10-18 01:31:05 +02:00
fi