diff --git a/examples/example.borg b/examples/example.borg index 9544a9407c95bf3c0df23a074c3875a5e162cbbd..e7425ecf6bab819114fe8165e10acdcca443bb21 100644 --- a/examples/example.borg +++ b/examples/example.borg @@ -130,6 +130,16 @@ exclude = /var/lib/mysql ## Default: # keep = 30d +## define hourly, daily, weekly and monthly retention for the "borg prune" operation. +## +## theses options will be ignored if set to 0 +## +## Default: +## keephourly = 0 +## keepdaily = 0 +## keepweekly = 0 +## keepmonthly = 0 + ## define extra command-line options for the "borg prune" operation. ## ## Example: diff --git a/handlers/borg.in b/handlers/borg.in index 0fc72b622844184f92061a328ca5900cbe30ad2e..06bde876bc4518d6f972a71f6c7f0dd37994435d 100644 --- a/handlers/borg.in +++ b/handlers/borg.in @@ -41,6 +41,10 @@ getconf exclude getconf create_options getconf prune yes getconf keep 30d +getconf keephourly 0 +getconf keepdaily 0 +getconf keepweekly 0 +getconf keepmonthly 0 getconf prune_options getconf cache_directory getconf filter_warnings yes @@ -240,6 +244,18 @@ if [ "$prune" == "yes" ]; then if [ ! "$keep" == "0" ]; then prune_options="${prune_options} --keep-within=${keep}" fi + if [ ! "$keephourly" == "0" ]; then + prune_options="${prune_options} --keep-hourly=${keephourly}" + fi + if [ ! "$keepdaily" == "0" ]; then + prune_options="${prune_options} --keep-daily=${keepdaily}" + fi + if [ ! "$keepweekly" == "0" ]; then + prune_options="${prune_options} --keep-weekly=${keepweekly}" + fi + if [ ! "$keepmonthly" == "0" ]; then + prune_options="${prune_options} --keep-monthly=${keepmonthly}" + fi prunestr="borg prune $options $prune_options $execstr_repository" debug "executing borg prune" debug "$prunestr"