#!/bin/bash ## Ansible managed set -e # Source environment variables if running manually/outside Systemd if [ -f /etc/restic-backup.env ]; then # shellcheck source=/dev/null . /etc/restic-backup.env fi 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)"