From ae6020da73549cc85c3816fe903d3fbbcb81b904 Mon Sep 17 00:00:00 2001 From: Usman Iqbal Date: Sat, 7 Dec 2024 13:58:38 +0000 Subject: [PATCH] Add support for passing in extra args to the `restic forget` command` --- README.md | 1 + templates/restic_script_Linux.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e365ef1..5d06749 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ Available variables: | `keep_within` | no | If set, only keeps snapshots in this time period. | | `keep_tag` | no | If set, keep snapshots with this tags. Make sure to specify a list. | | `prune` | no (`false`) | If `true`, the `restic forget` command in the script has the [`--prune` option](https://restic.readthedocs.io/en/stable/060_forget.html#removing-backup-snapshots) appended. | +| `forget_extra_args` | no | Extra arguments to pass to the `restic forget` command. | | `scheduled` | no (`false`) | If `restic_create_schedule` is set to `true`, this backup is scheduled and tries to create a systemd timer unit. If it fails, it is creating a cronjob. | | `schedule_oncalendar` | ``'*-*-* 02:00:00'`` | The time for the systemd timer. Please notice the randomDelaySec option. By Default the backup is done every night at 2 am (+0-4h). But only if scheduled is true. | | `schedule_minute` | no (`*`) | Minute when the job is run. ( 0-59, *, */2, etc ) | diff --git a/templates/restic_script_Linux.j2 b/templates/restic_script_Linux.j2 index 105603c..ef741db 100644 --- a/templates/restic_script_Linux.j2 +++ b/templates/restic_script_Linux.j2 @@ -302,7 +302,7 @@ esac {# Define stdin forget commands #} -{{ restic_install_path }}/restic forget {{ paths(item) }} {{ retention_pattern(item) }} {% if item.prune is defined and item.prune == true %}--prune{% endif %} {{ forget_output_log }} +{{ restic_install_path }}/restic forget {{ paths(item) }} {{ retention_pattern(item) }} {% if item.prune is defined and item.prune == true %}--prune{% endif %} {% if item.forget_extra_args is defined %}{{ item.forget_extra_args }}{% endif %} {{ forget_output_log }} if [[ $? -eq 0 ]] then echo "$(date -u '+%Y-%m-%d %H:%M:%S') OK" {{ forget_result_log }}