From d747ee2c3600b9cb604bce64e54a8dbab30f4530 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Fri, 2 Feb 2024 17:12:04 +0100 Subject: [PATCH] support "never" for prune-after, verify-after --- docs/30_Configuration/30_Filetransfer.md | 26 ++++++++++++++++++++++++ jobs/transfer.job.dist | 3 ++- transfer.sh | 11 ++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/docs/30_Configuration/30_Filetransfer.md b/docs/30_Configuration/30_Filetransfer.md index de1f6cb..6e394b0 100644 --- a/docs/30_Configuration/30_Filetransfer.md +++ b/docs/30_Configuration/30_Filetransfer.md @@ -83,6 +83,32 @@ When restoring data ... this is the path for restored files: `restore-path = /restore` +### Prune, Verify + +After a transfer you can apply a verify or prune action. + +To execute them after each run (which is not needed) set its values to 0. + +```txt +prune-after = 0 +verify-after = 0 +``` + +You can execute prune and verify only if it didn't run for N days. Set an integer in days here: + +```txt +prune-after = 3 +verify-after = 7 +``` + +You can disable it to run it as an extra job using verify.sh or prune.sh. +You must disable prune-after if you use rest:https to a restic rest server with enabled append-only option. + +```txt +prune-after = never +verify-after = 7 +``` + ### Duplicity settings ### When writing backup data duplicity creates the target file and a index. diff --git a/jobs/transfer.job.dist b/jobs/transfer.job.dist index bd3fffd..e5a4df9 100644 --- a/jobs/transfer.job.dist +++ b/jobs/transfer.job.dist @@ -109,7 +109,8 @@ restore-path = /restore # ---------------------------------------------------------------------- # number of days when to prune and verify backup. -# set it to 0 to run prune and verify in each backup run. +# set it to 0 to run prune and verify in each backup +# set it to "never" to disable it during backup and execute it outside the backup run. prune-after = 3 verify-after = 7 diff --git a/transfer.sh b/transfer.sh index fed5c42..6e388dd 100755 --- a/transfer.sh +++ b/transfer.sh @@ -38,6 +38,7 @@ # 2022-11-04 ah v2.8 rename hooks # 2022-11-07 ah v2.9 run brefore-transfer hook after registration # 2023-02-22 ah v2.10 fix touch of last_backup +# 2024-02-02 ah v2.11 support "never" for prune-after, verify-after # ================================================================================ @@ -141,8 +142,13 @@ function setAction(){ local action=$1 local myfile=$2 - typeset -i local iLimit - iLimit=$(_j_getvar ${STORAGEFILE} "$action-after") + local iLimit + iLimit=$(_j_getvar ${STORAGEFILE} "${action}-after") + if [ "$iLimit" = "never" ]; then + echo "Info: $action is set to [never] and is disabled." + doValue=0 + return + fi if [ ! -f "${myfile}" ]; then echo "Info: $action is ENABLED - no last $action detected" @@ -226,6 +232,7 @@ function setAction(){ echo fi +exit . $(dirname $0)/plugins/transfer/$STORAGE_BIN.sh || exit 1 # -------------------------------------------------------------------------------- -- GitLab