rdiff: handle "keep = yes" to disable old backups removal (Closes: #424633)
authorintrigeri <intrigeri@758a04ac-41e6-0310-8a23-8373a73cc35d>
Tue, 19 Jun 2007 09:55:13 +0000 (09:55 +0000)
committerintrigeri <intrigeri@758a04ac-41e6-0310-8a23-8373a73cc35d>
Tue, 19 Jun 2007 09:55:13 +0000 (09:55 +0000)
git-svn-id: http://code.autistici.org/svn/backupninja/trunk@472 758a04ac-41e6-0310-8a23-8373a73cc35d

ChangeLog
examples/example.rdiff
handlers/rdiff

index 1179b03a3879db4ad4aefff397d67fdaffcc6a7f..6ad819e60c21f75689fa12941198e65f2455ed19 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@ version 0.9.5 -- unreleased
           (Closes: #396578)
        rdiff:
         . Added cstream support to allow for bandwidth limiting
+        . Handle "keep = yes" to disable old backups removal (Closes: #424633)
        rub
         . Fixed typo in rub handler that caused it to not work
         . Changed to use lib/vserver code
index 5ad700be624eb014e23c4d05c407054a8602afa9..c327fd61564b43095b58d77920355e396de35865 100644 (file)
@@ -38,6 +38,8 @@ type = local
 
 # how many days of data to keep
 # (you can also use the time format of rdiff-backup, e.g. 6D5h)
+# (to keep everything, set this to yes)
+#keep = yes
 keep = 60
 
 # A few notes about includes and excludes:
index 5561435331d6c0dab76e2f66678d52cd00309585..52637cd42ee2eb2b7c8ab5313762735d3a8c1bab 100644 (file)
@@ -152,27 +152,31 @@ esac
        
 ### REMOVE OLD BACKUPS ###
 
-if [ "`echo $keep | tr -d 0-9`" == "" ]; then
+if [ "$keep" != yes ]; then
+
+   if [ "`echo $keep | tr -d 0-9`" == "" ]; then
        # add D if no other date unit is specified
-       keep="${keep}D"
-fi
+      keep="${keep}D"
+   fi
 
-removestr="$RDIFFBACKUP $options --force --remove-older-than $keep "
-if [ "$desttype" == "remote" ]; then
-       removestr="${removestr}${destuser}@${desthost}::"
-fi
-removestr="${removestr}${destdir}/${label}";
+   removestr="$RDIFFBACKUP $options --force --remove-older-than $keep "
+   if [ "$desttype" == "remote" ]; then
+      removestr="${removestr}${destuser}@${desthost}::"
+   fi
+   removestr="${removestr}${destdir}/${label}";
+
+   debug "$removestr"
+   if [ $test = 0 ]; then
+      output="`su -c "$removestr" 2>&1`"
+      if [ $? = 0 ]; then
+        debug $output
+        info "Removing backups older than $keep days succeeded."
+      else
+        warning $output
+        warning "Failed removing backups older than $keep."
+      fi
+   fi
 
-debug "$removestr"
-if [ $test = 0 ]; then
-       output="`su -c "$removestr" 2>&1`"
-       if [ $? = 0 ]; then
-               debug $output
-               info "Removing backups older than $keep days succeeded."
-       else
-               warning $output
-               warning "Failed removing backups older than $keep."
-       fi
 fi
 
 # Add cstream