neb/skel/opt/scripts/restic/forget.sh
2023-10-18 23:12:25 +02:00

21 lines
550 B
Bash

#!/bin/sh
ntfy() {
sh /opt/scripts/ntfy.sh -s "/etc/ixvd/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
}
ntfy -m "forgetting old backups..." -p "low"
if restic \
-r "/mnt/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
ntfy -m "forget succeeded" -p "min"
else
ntfy -m "forget failed" -e "warning,skull" -p "urgent"
fi