feat: setup backups
This commit is contained in:
parent
08d731adc2
commit
89103dc0ee
3 changed files with 31 additions and 1 deletions
15
tools/server-backup.sh
Executable file
15
tools/server-backup.sh
Executable 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
|
15
tools/server-setup.d/50-backup-setup.sh
Executable file
15
tools/server-setup.d/50-backup-setup.sh
Executable 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
|
Loading…
Reference in a new issue