#!/bin/sh notify() { curl \ -X POST \ -H "Authorization: $(cat ${NTFY_SECRET_FILE:-/etc/ixvd/secrets/ntfy/infra-backups})" \ -d "$(hostname): $@" \ https://push.ixvd.net/infra-backups } notify "forgetting old backups..." 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 notify "forget succeeded" else notify "forget failed" fi