From 3a49de994d44c2c04300f6c2fe14b785f66b033b Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Wed, 9 Feb 2022 11:00:39 +0100 Subject: [PATCH] backup diff: detect initial backup --- plugins/transfer/restic.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh index 3433874..338849d 100644 --- a/plugins/transfer/restic.sh +++ b/plugins/transfer/restic.sh @@ -207,14 +207,20 @@ local _snapshotNow # get list of snapshots and filter the lines with a date YYYY-MM-DD - _data=$( t_restoreDoShowVolumes | grep "[12][0-9][0-9][0-1]-[0-2][0-9]-[0-3][0-9]" | tail -2 ) - - _snapshotLast=$( echo "$_data" | head -1 | cut -f 1 -d " ") - _snapshotNow=$( echo "$_data" | tail -1 | cut -f 1 -d " ") + _data=$( t_restoreDoShowVolumes | grep "[12][0-9][0-9][0-1]-[0-2][0-9]-[0-3][0-9]" | tail -5 ) + echo "..." echo "$_data" - color cmd - restic diff "${_snapshotLast}" "${_snapshotNow}" - color reset + + _snapshotLast=$( echo "$_data" | tail -2 | head -1 | cut -f 1 -d " ") + _snapshotNow=$( echo "$_data" | tail -1 | cut -f 1 -d " ") + + if [ "${_snapshotLast}" = "${_snapshotNow}" ]; then + echo "This was the initial (full) Backup" + else + color cmd + restic diff "${_snapshotLast}" "${_snapshotNow}" + color reset + fi echo } -- GitLab