27 lines
694 B
Django/Jinja
27 lines
694 B
Django/Jinja
#!/bin/bash
|
|
## Ansible managed
|
|
|
|
set -e
|
|
|
|
## Environment is injected by the systemd unit via EnvironmentFile=/etc/restic-backup.env. Run manually with: systemctl start restic-backup.service
|
|
|
|
echo "Starting Restic Backup at $(date)"
|
|
|
|
## Run the backup using paths and exclusions defined as group_vars
|
|
restic backup \
|
|
{% for path in backup_include_paths %}
|
|
"{{ path }}" \
|
|
{% endfor %}
|
|
{% for path in backup_exclude_paths %}
|
|
--exclude "{{ path }}" \
|
|
{% endfor %}
|
|
--cleanup-cache
|
|
|
|
restic forget \
|
|
--prune \
|
|
--keep-daily {{ backup_retention_daily }} \
|
|
--keep-weekly {{ backup_retention_weekly }} \
|
|
--keep-monthly {{ backup_retention_monthly }}
|
|
|
|
echo "Restic backup completed at $(date)"
|