[borg] support keephourly option

This commit is contained in:
Jerome Charaoui 2018-01-12 18:07:04 -05:00
parent fdd0280a00
commit 88adbaa990
3 changed files with 11 additions and 5 deletions

View File

@ -29,10 +29,11 @@
[source]
## how many days, weeks and months of data to keep
## how many hours, days, weeks and months of data to keep
## for more info see : borg prune -h
##
## Default:
# keephourly = 1
# keepdaily = 7
# keepweekly = 4
# keepmonthly = -1

View File

@ -252,6 +252,7 @@ do_borg_prune() {
set -o noglob
REPLY=
formBegin "$borg_title - pruning (how many backups to keep)"
formItem "hourly" "$borg_keephourly"
formItem "daily" "$borg_keepdaily"
formItem "weekly" "$borg_keepweekly"
formItem "monthly" "$borg_keepmonthly"
@ -259,9 +260,10 @@ do_borg_prune() {
[ $? = 0 ] || return
tmp_array=($REPLY)
borg_keepdaily=${tmp_array[0]}
borg_keepweekly=${tmp_array[1]}
borg_keepmonthly=${tmp_array[2]}
borg_keephourly=${tmp_array[0]}
borg_keepdaily=${tmp_array[1]}
borg_keepweekly=${tmp_array[2]}
borg_keepmonthly=${tmp_array[3]}
set +o noglob
@ -293,6 +295,7 @@ EOF
cat >> $next_filename <<EOF
## for more info see : borg prune -h
keephourly = $borg_keephourly
keepdaily = $borg_keepdaily
keepweekly = $borg_keepweekly
keepmonthly = $borg_keepmonthly
@ -357,6 +360,7 @@ borg_wizard() {
borg_compression=lz4
borg_encryption=none
borg_passphrase=
borg_keephourly=1
borg_keepdaily=7
borg_keepweekly=4
borg_keepmonthly=-1

View File

@ -22,6 +22,7 @@ getconf testconnect yes
getconf nicelevel 0
setsection source
getconf keephourly 1
getconf keepdaily 7
getconf keepweekly 4
getconf keepmonthly -1
@ -134,7 +135,7 @@ fi
### REMOVE OLD BACKUPS ###
# borg prune
prunestr="borg prune --keep-daily $keepdaily --keep-weekly $keepweekly --keep-monthly $keepmonthly $execstr_repository"
prunestr="borg prune --keep-hourly $keephourly --keep-daily $keepdaily --keep-weekly $keepweekly --keep-monthly $keepmonthly $execstr_repository"
debug "$prunestr"
if [ $test = 0 ]; then