Skip to content
Snippets Groups Projects
Commit 28a5b728 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

restic prune: add keep-last; add --cleanup-cache

parent 288ac3d6
No related branches found
No related tags found
1 merge request!325046 finetune restic params
......@@ -172,8 +172,11 @@ is a full backup and all following runs make an incremental backup.
You have the possibility to keep all younger backups and have the possibility to delete
older backups but to keep N weekly, monthly and yearly snapshots.
The value for "keep-last" never deletes the last N most recent snapshots.
```text
# prune
restic_keep-last = 5
restic_keep-hourly = 100
restic_keep-daily = 90
restic_keep-weekly = 12
......
......@@ -147,6 +147,7 @@ restic_tag = imlbackup
restic_mountpoint = /mnt/restore
# prune
restic_keep-last = 5
restic_keep-hourly = 100
restic_keep-daily = 90
restic_keep-weekly = 12
......
......@@ -161,22 +161,23 @@
echo "--- PRUNE"
local _tag=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}tag")
local _keep_h=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-hourly")
local _keep_d=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-daily")
local _keep_w=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-weekly")
local _keep_m=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-monthly")
local _keep_y=$( _j_getvar ${STORAGEFILE} "${CFGPREFIX}keep-yearly")
local _mycmd="restic forget \
${ARGS_DEFAULT} \
--tag $_tag \
--group-by "paths,tags" \
--keep-hourly $_keep_h \
--keep-daily $_keep_d \
--keep-weekly $_keep_w \
--keep-monthly $_keep_m \
--keep-yearly $_keep_y"
--group-by paths,tags \
--cleanup-cache"
local _keep
for mykeep in last hourly daily weekly monthly yearly
do
_keep=$( _j_getvar "${STORAGEFILE}" "${CFGPREFIX}keep-${mykeep}")
if [ -n "$_keep" ]; then
_mycmd="${_mycmd} --keep-${mykeep} ${_keep}"
fi
done
echo $_mycmd
sleep 3
color cmd
eval $_mycmd
local _myrc=$?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment