diff --git a/docs/30_Configuration/30_Filetransfer.md b/docs/30_Configuration/30_Filetransfer.md index de1f6cb3c815dce9573f981219b5dd7c99db9171..6e394b0c5888d7802f5d8622fbefd99eadbef45d 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 bd3fffd6dce7a08fed3f7bebf04bd70200101681..e5a4df90de9a2556c236ca65993dde551f803b0d 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 fed5c4231cd7a4130a058f84de62c9d41f512fcd..6e388ddf975deea90f38e8626b29b7cf95d180f2 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 # --------------------------------------------------------------------------------