From 801f8590ab4d2e6ecb1ef6941d24f79336e656e8 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sun, 5 Dec 2021 18:31:50 +0100 Subject: [PATCH] updated borg state --- states/borg/templates/borg_job.sh.j2 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/states/borg/templates/borg_job.sh.j2 b/states/borg/templates/borg_job.sh.j2 index 57f8bd1..fd83a9c 100644 --- a/states/borg/templates/borg_job.sh.j2 +++ b/states/borg/templates/borg_job.sh.j2 @@ -27,6 +27,11 @@ info "Starting backup" info "Init repository backup" borg init --encryption={{ job.encryption|default('repokey-blake2') }} +info "Starting before tasks" +{%- for task in job.before_tasks|default([]) %} +{{ task }} +{%- endfor %} + info "Creating new archive" borg create \ --verbose \ @@ -61,6 +66,11 @@ borg prune \ info "Cleaning up logs" find {{ working_dir }}/logs/${backup_name}-*.log -mtime +{{ job.keep_logs_days|default(7) }} -delete +info "Starting after tasks" +{%- for task in job.after_tasks|default([]) %} +{{ task }} +{%- endfor %} + prune_exit=$? global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))