From 714e1f3ada700140a159f7a419ea6c53e02d0d75 Mon Sep 17 00:00:00 2001 From: L3D Date: Mon, 14 Dec 2020 16:13:34 +0100 Subject: [PATCH] Restic create mail overview... --- templates/restic_forget_snapshots.j2 | 12 ++++++------ templates/restic_mailsummary.j2 | 27 ++++++++++++++------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/templates/restic_forget_snapshots.j2 b/templates/restic_forget_snapshots.j2 index 379d669..63d8f72 100644 --- a/templates/restic_forget_snapshots.j2 +++ b/templates/restic_forget_snapshots.j2 @@ -58,7 +58,7 @@ set -euxo pipefail # Settings for Server {{ repo['name'] | string }} export RESTIC_REPOSITORY="{{ repo['location'] }}" -export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' +export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null BACKUP_NAME="{{ repo.name }}" restic forget {{ retention_pattern(repo) }} @@ -68,9 +68,9 @@ restic check {% if repo.archive|default(false) %} # ARCHIVE Settings for Server "{{ repo['name'] | string }}" export RESTIC_REPOSITORY="{{ repo['archive_location'] }}" -export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' +export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null export RESTIC_REPOSITORY2="{{ repo['location'] }}" -export RESTIC_PASSWORD2='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' +export RESTIC_PASSWORD2='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null BACKUP_NAME="{{ repo.name }}_archive" # init repo if it does not exist @@ -90,9 +90,9 @@ set -euxo pipefail {% endif %} # ARCHIVE Settings for Server "{{ repo['name'] | string }}" export RESTIC_REPOSITORY2="{{ repo['archive_location'] }}" -export RESTIC_PASSWORD2='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' +export RESTIC_PASSWORD2='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null export RESTIC_REPOSITORY="{{ repo['location'] }}" -export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' +export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null # transfer snapshots to archive restic copy @@ -111,7 +111,7 @@ set -euxo pipefail {% endif %} # ARCHIVE CLEANUP Settings for Server "{{ repo['name'] | string }}" export RESTIC_REPOSITORY="{{ repo['archive_location'] }}" -export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' +export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null BACKUP_NAME="{{ repo.name }}_archive" restic forget {{ retention_pattern(repo) }} diff --git a/templates/restic_mailsummary.j2 b/templates/restic_mailsummary.j2 index 9aecc80..43007e5 100644 --- a/templates/restic_mailsummary.j2 +++ b/templates/restic_mailsummary.j2 @@ -6,39 +6,40 @@ echo "Summary for Restic Backup" {% for repo in restic_archiver__repos %} # Settings for Server {{ repo['name'] | string }} -export RESTIC_REPOSITORY="{{ repo['location'] }}" -export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' -BACKUP_NAME="{{ repo.name }}" +export RESTIC_REPOSITORY="{{ repo['location'] }}" 2>/dev/null +export RESTIC_PASSWORD='{{ repo['password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null +BACKUP_NAME="{{ repo.name }}" 2>/dev/null echo "BACKUP: {{ repo.name }}" -restic check -restic stats +restic check 2>/dev/null +restic stats 2>/dev/null {% if repo.archive|default(false) %} {% if restic_archiver__mount_required %} -set +euxo pipefail +set +euxo pipefail 2>/dev/null if mountpoint -q {{ restic_archiver__mount_disk }} then echo "{{ restic_archiver__mount_disk }} is mounted" else - mount -a + mount -a 2>/dev/null fi -set -euxo pipefail +set -euxo pipefail 2>/dev/null {% endif %} # ARCHIVE Settings for Server "{{ repo['name'] | string }}" echo "EXTERNAL_BACKUP: {{ repo.name }}" -export RESTIC_REPOSITORY="{{ repo['archive_location'] }}" -export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' -BACKUP_NAME="{{ repo.name }}_archive" +export RESTIC_REPOSITORY="{{ repo['archive_location'] }}" 2>/dev/null +export RESTIC_PASSWORD='{{ repo['archive_password'] | regex_replace('\'', '\'\\\'\'') }}' 2>/dev/null +BACKUP_NAME="{{ repo.name }}_archive" 2>/dev/null -restic check -restic stats +restic check 2>/dev/null +restic statps {% endif %} {% endfor %} sync set +euxo pipefail +echo "\n\n\n\n" df -h {% if restic_archiver__umount_after_usage %} umount {{ restic_archiver__mount_disk }}