added backup retention
This commit is contained in:
parent
744220e1a2
commit
1c3b17ee3f
16
btrbk
16
btrbk
|
@ -170,11 +170,17 @@ function testConf {
|
|||
}
|
||||
|
||||
function testDate {
|
||||
if [ `date +%d` != "01" ]; then
|
||||
bkRun "incremental"
|
||||
else
|
||||
bkRun "full"
|
||||
if [ $BKCYCLE = "weekly" ]; then
|
||||
local dateType = "+%u"
|
||||
elif [ $BKCYCLE = "monthly" ]; then
|
||||
local dateType = "+%d"
|
||||
fi
|
||||
for i in ${!BKRETENTION[@]}; do
|
||||
if [ `date $dateType` = ${BKRETENTION[$i]} ]; then
|
||||
bkRun "full"
|
||||
fi
|
||||
done
|
||||
bkRun "incremental"
|
||||
}
|
||||
|
||||
function end {
|
||||
|
@ -196,7 +202,7 @@ function echoHelp {
|
|||
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"
|
||||
for i in ${!options[@]}; do
|
||||
case $1 in
|
||||
|
|
|
@ -22,6 +22,15 @@ RCLONEDIR="test:/mnt/bk/new/"
|
|||
#How many local snapshots should be kept
|
||||
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
|
||||
#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
|
||||
|
|
Loading…
Reference in a new issue