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

18 lines
580 B
Django/Jinja

#!/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"
done
# Prune older backups
/usr/local/bin/restic forget --keep-last 7 && \
/usr/local/bin/restic prune