homelab/roles/restic/templates/backup-all.sh.j2

18 lines
580 B
Plaintext
Raw Normal View History

2024-01-10 13:51:51 +01:00
#!/usr/bin/env bash
# This script sequentially executes all shell scripts matching
# /etc/backups/*.backup.sh, with environment variables configured to publish
# backups to the local Restic REST server.
# Get passed along to subcalls to bash
export RESTIC_REPOSITORY='rest:http://{{ groups['nas'][0] }}:8000/backups'
export RESTIC_PASSWORD_FILE='/etc/backups/restic_backups_passwd'
for script in $(find /etc/backups -name '*.backup.sh'); do
/usr/bin/bash "$script"
2024-01-10 13:51:51 +01:00
done
# Prune older backups
/usr/local/bin/restic forget --keep-last 7 && \
/usr/local/bin/restic prune