neb/common/restic/forget.sh

22 lines
537 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 /neb/common/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
2023-10-18 01:31:05 +02:00
}
2023-10-18 01:57:15 +02:00
ntfy -m "forgetting old backups..."
2023-10-18 01:31:05 +02:00
if restic \
-r "sftp://ixvd_backup_storage//backups/restic-$(hostname)" \
-p "/etc/ixvd/secrets/restic/$(hostname).secret" \
forget \
--keep-last 10 \
--keep-tag keep \
--keep-daily 20 \
--keep-weekly 20 \
--keep-monthly 6 \
--keep-yearly 10; then
2023-10-18 01:57:15 +02:00
ntfy -m "forget succeeded"
2023-10-18 01:31:05 +02:00
else
2023-10-18 01:57:15 +02:00
ntfy -m "forget failed" -e "warning,skull"
2023-10-18 01:31:05 +02:00
fi