23 lines
614 B
Django/Jinja
Executable file
23 lines
614 B
Django/Jinja
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
source /etc/backup-client/retention.env
|
|
|
|
{% if backup_backend == 'restic' %}
|
|
# restic backend
|
|
source /etc/backup-client/restic.env
|
|
restic forget \
|
|
--cleanup-cache {% if not backup_restic_cache %} --no-cache{% endif %} \
|
|
--verbose \
|
|
--prune \
|
|
--group-by "host,paths,tags" \
|
|
--keep-hourly ${BACKUP_RETENTION_HOURS} \
|
|
--keep-daily ${BACKUP_RETENTION_DAYS} \
|
|
--keep-weekly ${BACKUP_RETENTION_WEEKS} \
|
|
--keep-monthly ${BACKUP_RETENTION_MONTHS} \
|
|
--keep-yearly ${BACKUP_RETENTION_YEARS}
|
|
|
|
{% endif %}
|
|
{% if not backup_backend %}
|
|
echo "Noop, backup is handled external"
|
|
{% endif %}
|