#!/usr/bin/env bash # Ночной бэкап: локальный репозиторий на отдельном диске, затем копия на VPS. # В /etc/restic/remote-url лежит адрес вида # rest:https://box:ПАРОЛЬ@backup.example.org/box/main set -euo pipefail export RESTIC_PASSWORD_FILE=/etc/restic/password LOCAL=/mnt/backup/restic REMOTE=/etc/restic/remote-url restic -r "$LOCAL" backup /srv/data /etc \ --exclude-file=/etc/restic/excludes.txt \ --tag nightly restic -r "$LOCAL" forget --tag nightly \ --keep-daily 7 --keep-weekly 5 --keep-monthly 12 --prune restic --repository-file "$REMOTE" copy \ --from-repo "$LOCAL" \ --from-password-file "$RESTIC_PASSWORD_FILE"