added options, keep passed directly to rdiff-backup
authorelijah <elijah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Wed, 19 Jan 2005 19:39:14 +0000 (19:39 +0000)
committerelijah <elijah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Wed, 19 Jan 2005 19:39:14 +0000 (19:39 +0000)
git-svn-id: http://code.autistici.org/svn/backupninja/trunk@80 758a04ac-41e6-0310-8a23-8373a73cc35d

etc/backup.d/example.rdiff
handlers/rdiff

index f0b9afb3b334cf9373122137e4f1ef88e4e97455..476cf5a7cce4bedfde00836c147a60966c05949f 100644 (file)
@@ -1,4 +1,7 @@
 
+## passed directly to rdiff-backup
+# options = --force
+
 ######################################################
 ## source section
 ## (where the files to be backed up are coming from)
@@ -12,7 +15,8 @@ label = thishostname
 type = local
 
 # how many days of data to keep
-keep = 185
+# (you can also use the time format of rdiff-backup, e.g. 6D5h)
+keep = 60
 
 # files to include in the backup
 # (supports globbing with '*')
index 90ca2a3ebf39f72e7d626c11d72ab28a3d48193c..730e660cfb9dc5d9664fd064981f65e031328a38 100644 (file)
@@ -3,11 +3,13 @@
 # requires rdiff-backup
 #
 
+getconf options
+
 setsection source
 getconf type; sourcetype=$type
 getconf label
 getconf user root; sourceuser=$user
-getconf keep
+getconf keep 60
 getconf include
 getconf exclude
 
@@ -55,30 +57,32 @@ execstr_clientpart="/"
        
 ## REMOVE OLD BACKUPS
 
-if [ "$keep" -gt "0" ]; then
-       removestr="rdiff-backup --force --remove-older-than ${keep}D "
-       if [ "$desttype" == "remote" ]; then
-               removestr="${removestr}${destuser}@${desthost}::"
-       fi
-       removestr="${removestr}${destdir}/${label}";
-       
-       debug "su $sourceuser -c '$removestr'"
-       if [ ! $test ]; then
-               output=`su $sourceuser -c "$removestr" 2>&1`
-               code=$?
-               if [ "$code" == "0" ]; then
-                       debug $output
-                       info "Removing backups older than $keep days succeeded."
-               else
-                       warning $output
-                       warning "Failed removing backups older than $keep."
-               fi
+if [ "`echo $keep | tr -d 0-9`" == "" ]; then
+       keep="${keep}D"
+fi
+
+removestr="rdiff-backup --force --remove-older-than $keep "
+if [ "$desttype" == "remote" ]; then
+       removestr="${removestr}${destuser}@${desthost}::"
+fi
+removestr="${removestr}${destdir}/${label}";
+
+debug "su $sourceuser -c '$removestr'"
+if [ ! $test ]; then
+       output=`su $sourceuser -c "$removestr" 2>&1`
+       code=$?
+       if [ "$code" == "0" ]; then
+               debug $output
+               info "Removing backups older than $keep days succeeded."
+       else
+               warning $output
+               warning "Failed removing backups older than $keep."
        fi
 fi
 
 ## EXECUTE ##
        
-execstr="$RDIFFBACKUP --print-statistics "
+execstr="$RDIFFBACKUP $options --print-statistics "
 
 # TODO: order the includes and excludes