From 708a2d97c19086c5a658d0096c0602c5959ec5a2 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 4 Oct 2022 11:55:17 +0200 Subject: [PATCH] prune and verify are non directory based --- plugins/transfer/duplicity.sh | 9 ++++++-- plugins/transfer/restic.sh | 12 ++++++---- transfer.sh | 41 ++++++++++++++++++++++------------- 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/plugins/transfer/duplicity.sh b/plugins/transfer/duplicity.sh index 2b1788c..262cad0 100644 --- a/plugins/transfer/duplicity.sh +++ b/plugins/transfer/duplicity.sh @@ -174,9 +174,9 @@ fi } - # prune old data + # forget old data # uses global vars from ../../transfer.sh - function t_backupDoPrune(){ + function t_backupDoForget(){ echo "--- FORGET some data" cmd="duplicity remove-older-than $STORAGE_KEEP --force ${ARGS_DEFAULT} ${STORAGE_TARGETPATH}" echo $cmd @@ -187,6 +187,11 @@ t_rcCheckCleanup $myrc } + # prune old data + # uses global vars from ../../transfer.sh + function t_backupDoPrune(){ + echo "--- PRUNE is not implemented yet for duplicity." + } # verify backup data # uses global vars from ../../transfer.sh function t_backupDoVerify(){ diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh index 9925c42..3b6c73f 100644 --- a/plugins/transfer/restic.sh +++ b/plugins/transfer/restic.sh @@ -170,11 +170,10 @@ echo } - - # prune old data + # forget data # uses global vars from ../../transfer.sh - function t_backupDoPrune(){ - # -------------------- + function t_backupDoForget(){ + echo "--- FORGET some data" local _tag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}tag") @@ -183,6 +182,7 @@ --tag $_tag \ --group-by paths,tags \ --prune \ + --path ${BACKUP_DIR} \ --cleanup-cache" local _keep @@ -203,6 +203,10 @@ t_rcCheckCleanup $_myrc echo + } + # prune old data + # uses global vars from ../../transfer.sh + function t_backupDoPrune(){ # -------------------- echo "--- PRUNE" diff --git a/transfer.sh b/transfer.sh index ab40b40..af2efd3 100755 --- a/transfer.sh +++ b/transfer.sh @@ -31,6 +31,7 @@ # 2021-12-02 ah v2.1 added parameter "prune" to cleanup only # 2022-02-10 ah v2.2 update logging (removing tee) # 2022-10-01 ah v2.3 customize prune and verify action +# 2022-10-04 ah v2.4 prune and verify are non directory based # ================================================================================ @@ -406,22 +407,10 @@ function setAction(){ # --- prune if [ $doPrune -eq 0 ]; then - echo "SKIP prune" + echo "SKIP forget data" else - h3 "`date` PRUNE for ${BACKUP_DIR}" - t_backupDoPrune - touch ${lastprunefile} - echo - fi - echo - - # --- verify - if [ $doVerify -eq 0 ]; then - echo "SKIP verify" - else - h3 "`date` VERIFY for ${BACKUP_DIR}" - t_backupDoVerify - touch ${lastverifyfile} + h3 "`date` FORGET data of ${BACKUP_DIR}" + t_backupDoForget echo fi echo @@ -433,6 +422,28 @@ function setAction(){ fi echo done + + # --- prune + if [ $doPrune -eq 0 ]; then + echo "SKIP prune" + else + h3 "`date` PRUNE repository data" + t_backupDoPrune + touch ${lastprunefile} + echo + fi + echo + + # --- verify + if [ $doVerify -eq 0 ]; then + echo "SKIP verify" + else + h3 "`date` VERIFY repository data" + t_backupDoVerify + touch ${lastverifyfile} + echo + fi + echo echo $rc > ${rcfile} exit $rc -- GitLab