fix: restic

This commit is contained in:
Strix 2023-10-18 01:57:15 +02:00
parent d2258d5808
commit 2b5e12b937
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
5 changed files with 40 additions and 29 deletions

View file

@ -1,13 +1,17 @@
#!/bin/sh
/neb/common/ntfy.sh -m "performing backup..." -e "warning" https://push.ixvd.net/infra-backups
ntfy() {
sh /neb/common/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
}
ntfy -m "performing backup..."
if restic \
-r "sftp://ixvd_backup_storage//backups/restic-$(hostname)" \
-p "/neb/secrets/restic/$(hostname).secret" \
backup \
--tag auto \
/srv /home /etc; then
/neb/common/ntfy.sh -m "backup succeeded" -e "warning" https://push.ixvd.net/infra-backups
ntfy -m "backup succeeded"
else
/neb/common/ntfy.sh -p "urgent" -m "backup failed" -e "warning,skull" https://push.ixvd.net/infra-backups
ntfy -m "backup failed" -e "warning,skull"
fi

View file

@ -1,14 +1,10 @@
#!/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
ntfy() {
sh /neb/common/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
}
notify "forgetting old backups..."
ntfy -m "forgetting old backups..."
if restic \
-r "sftp://ixvd_backup_storage//backups/restic-$(hostname)" \
-p "/etc/ixvd/secrets/restic/$(hostname).secret" \
@ -19,7 +15,7 @@ if restic \
--keep-weekly 20 \
--keep-monthly 6 \
--keep-yearly 10; then
notify "forget succeeded"
ntfy -m "forget succeeded"
else
notify "forget failed"
ntfy -m "forget failed" -e "warning,skull"
fi

View file

@ -1,13 +1,15 @@
#!/bin/sh
notify() {
curl \
-X POST \
-H "Title: $0" \
-H "Priority: urgent" \
-H "Tags: warning" \
-d "$(hostname): $@" \
https://push.ixvd.net/infra-backups
ntfy() {
sh /neb/common/ntfy.sh -s "/neb/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
}
notify "pruning old backups..."
ntfy -m "pruning old backups..."
if restic \
-r "sftp://ixvd_backup_storage//backups/restic-$(hostname)" \
-p "/etc/ixvd/secrets/restic/$(hostname).secret" \
prune; then
notify -m "pruning succeeded"
else
notify -m "prune failed" -e "warning,skull"
fi