feat: setup backups

This commit is contained in:
Strix 2023-10-26 14:30:45 +02:00
parent 08d731adc2
commit 89103dc0ee
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
3 changed files with 31 additions and 1 deletions

15
tools/server-backup.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
#!/bin/sh
ntfy() {
bash /opt/scripts/ntfy.sh -s "/etc/ixvd/secrets/ntfy/ixvd-backups" -u "https://push.ixvd.net/ixvd-backups" "$@"
}
echo "creating backup with keep tag..."
restic \
-r "/mnt/backups/restic/$(hostname)" \
-p "/etc/ixvd/secrets/restic/$(hostname).secret" \
backup \
--tag keep \
/srv /home /etc

View file

@ -0,0 +1,15 @@
#!/bin/sh
HOSTNAME=${HOSTNAME:-$(hostname)}
if ! [ -d /mnt/backups/restic/$HOSTNAME ]; then
echo "creating restic repo for $HOSTNAME..."
if ! [ -f /etc/ixvd/secrets/restic/$HOSTNAME.secret ]; then
echo "no secret for $HOSTNAME found."
exit 1
fi
restic \
-r /mnt/backups/restic/$HOSTNAME \
-p /etc/ixvd/secrets/restic/$HOSTNAME.secret \
init
fi