dotfiles/crates/90-backups/scripts/backup.sh

41 lines
877 B
Bash
Raw Normal View History

2024-03-07 14:25:45 +01:00
#!/bin/bash
HOSTNAME=${HOSTNAME:-$(hostname)}
log() {
echo "log: $@"
if [ -f "/var/backups/ntfy.env" ]; then
. /var/backups/ntfy.env
curl \
-s \
-d "$@" \
${NTFY_URL:-https://push.ixvd.net/logs}
fi
}
log starting backup for $HOSTNAME
restic \
-r /var/backups/$HOSTNAME \
-p /var/backups/$HOSTNAME.secret \
backup \
--tag auto \
--exclude-caches \
--exclude dist \
--exclude target \
--exclude node_modules \
--exclude bin \
--exclude .cache \
--exclude '.config/*/cache' \
--exclude '.config/*/Cache' \
--exclude .cargo/git \
--exclude .cargo/registry \
--exclude '.rustup' \
--exclude '.local' \
--exclude '.var' \
--exclude Steam \
--exclude '.config/Code' \
--exclude '.config/Code - OSS' \
--exclude 'code/linux' \
--exclude Downloads \
/srv /home /etc
log backup finished with $?