added backup retention
This commit is contained in:
parent
744220e1a2
commit
1c3b17ee3f
16
btrbk
16
btrbk
|
@ -170,11 +170,17 @@ function testConf {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDate {
|
function testDate {
|
||||||
if [ `date +%d` != "01" ]; then
|
if [ $BKCYCLE = "weekly" ]; then
|
||||||
bkRun "incremental"
|
local dateType = "+%u"
|
||||||
else
|
elif [ $BKCYCLE = "monthly" ]; then
|
||||||
bkRun "full"
|
local dateType = "+%d"
|
||||||
fi
|
fi
|
||||||
|
for i in ${!BKRETENTION[@]}; do
|
||||||
|
if [ `date $dateType` = ${BKRETENTION[$i]} ]; then
|
||||||
|
bkRun "full"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
bkRun "incremental"
|
||||||
}
|
}
|
||||||
|
|
||||||
function end {
|
function end {
|
||||||
|
@ -196,7 +202,7 @@ function echoHelp {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
options=$(getopt -l "backup,force,date::,restore::,full-restore::,help" -o "bfd::r::x::h" -- "$@")
|
options=$(getopt -l "backup,force,date::,restore::,full-restore::,help" -o "bfx::h" -- "$@")
|
||||||
eval set -- "$options"
|
eval set -- "$options"
|
||||||
for i in ${!options[@]}; do
|
for i in ${!options[@]}; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
|
@ -22,6 +22,15 @@ RCLONEDIR="test:/mnt/bk/new/"
|
||||||
#How many local snapshots should be kept
|
#How many local snapshots should be kept
|
||||||
KEEPLOCAL="10"
|
KEEPLOCAL="10"
|
||||||
|
|
||||||
|
#How often to run a full backup: "monthly" or "weekly"
|
||||||
|
BKCYCLE="monthly"
|
||||||
|
|
||||||
|
#Day when to run full Backup
|
||||||
|
#can be specified multiple times 1-7 for weekely and 01-30 for monthly
|
||||||
|
#example ("01" "05" "23")
|
||||||
|
BKRETENTION=("01")
|
||||||
|
|
||||||
|
|
||||||
#Suffix name for incremental/full backups and retention
|
#Suffix name for incremental/full backups and retention
|
||||||
#example: [YYYY-mm-"full"] and will keep the last two backups
|
#example: [YYYY-mm-"full"] and will keep the last two backups
|
||||||
#For full Backups dont set retention below 1 or you will always delete your current backup which renders all following incremental backups useless
|
#For full Backups dont set retention below 1 or you will always delete your current backup which renders all following incremental backups useless
|
||||||
|
|
Loading…
Reference in a new issue