mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-12 13:52:50 +01:00
[borg] add 'prune' setting to allow disabling pruning
This commit is contained in:
parent
60601b2f4c
commit
830a00759f
@ -259,25 +259,32 @@ do_borg_con() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_borg_prune() {
|
do_borg_prune() {
|
||||||
declare -a tmp_array
|
radioBox "$borg_title" "pruning (how many backups to keep" \
|
||||||
|
"yes" "regularly prune old backups" on \
|
||||||
|
"no" "keep all backups" off
|
||||||
|
[ $? = 1 ] && return;
|
||||||
|
borg_prune="$REPLY"
|
||||||
|
|
||||||
set -o noglob
|
if [ "$borg_prune" = "yes" ]; then
|
||||||
REPLY=
|
declare -a tmp_array
|
||||||
formBegin "$borg_title - pruning (how many backups to keep)"
|
set -o noglob
|
||||||
formItem "hourly" "$borg_keephourly"
|
REPLY=
|
||||||
formItem "daily" "$borg_keepdaily"
|
formBegin "$borg_title - pruning (how many backups to keep)"
|
||||||
formItem "weekly" "$borg_keepweekly"
|
formItem "hourly" "$borg_keephourly"
|
||||||
formItem "monthly" "$borg_keepmonthly"
|
formItem "daily" "$borg_keepdaily"
|
||||||
formDisplay
|
formItem "weekly" "$borg_keepweekly"
|
||||||
|
formItem "monthly" "$borg_keepmonthly"
|
||||||
|
formDisplay
|
||||||
|
|
||||||
[ $? = 0 ] || return
|
[ $? = 0 ] || return
|
||||||
tmp_array=($REPLY)
|
tmp_array=($REPLY)
|
||||||
borg_keephourly=${tmp_array[0]}
|
borg_keephourly=${tmp_array[0]}
|
||||||
borg_keepdaily=${tmp_array[1]}
|
borg_keepdaily=${tmp_array[1]}
|
||||||
borg_keepweekly=${tmp_array[2]}
|
borg_keepweekly=${tmp_array[2]}
|
||||||
borg_keepmonthly=${tmp_array[3]}
|
borg_keepmonthly=${tmp_array[3]}
|
||||||
|
|
||||||
set +o noglob
|
set +o noglob
|
||||||
|
fi
|
||||||
|
|
||||||
_prune_done="(DONE)"
|
_prune_done="(DONE)"
|
||||||
}
|
}
|
||||||
@ -307,6 +314,7 @@ EOF
|
|||||||
cat >> $next_filename <<EOF
|
cat >> $next_filename <<EOF
|
||||||
|
|
||||||
## for more info see : borg prune -h
|
## for more info see : borg prune -h
|
||||||
|
prune = $borg_prune
|
||||||
keephourly = $borg_keephourly
|
keephourly = $borg_keephourly
|
||||||
keepdaily = $borg_keepdaily
|
keepdaily = $borg_keepdaily
|
||||||
keepweekly = $borg_keepweekly
|
keepweekly = $borg_keepweekly
|
||||||
|
@ -22,6 +22,7 @@ getconf testconnect yes
|
|||||||
getconf nicelevel 0
|
getconf nicelevel 0
|
||||||
|
|
||||||
setsection source
|
setsection source
|
||||||
|
getconf prune yes
|
||||||
getconf keephourly 1
|
getconf keephourly 1
|
||||||
getconf keepdaily 7
|
getconf keepdaily 7
|
||||||
getconf keepweekly 4
|
getconf keepweekly 4
|
||||||
@ -138,7 +139,7 @@ fi
|
|||||||
prunestr="borg prune --keep-hourly $keephourly --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"
|
debug "$prunestr"
|
||||||
|
|
||||||
if [ $test = 0 ]; then
|
if [ $test = 0 ] && [ "$prune" == "yes" ]; then
|
||||||
output="`su -c "$prunestr" 2>&1`"
|
output="`su -c "$prunestr" 2>&1`"
|
||||||
if [ $? = 0 ]; then
|
if [ $? = 0 ]; then
|
||||||
debug $output
|
debug $output
|
||||||
|
Loading…
Reference in New Issue
Block a user