Em Fri, Jan 27, 2012 at 10:16:59AM +0100, Paul van Tilburg escreveu:
> On Thu, Jan 26, 2012 at 10:39:55AM +0100, Paul van Tilburg wrote:
> 
> Probably it though 26 Jan 03:17 was not 24 hours away and thus it
> replaced the backup.  But say one has a monotonously growing backup,
> then the backup takes slightly longer each night and thus the script
> will always conclude it has not been over 24h and it always replaces the
> backup. 

Hi Paul, thanks for pointing that and sorry for my delay.

This behavior looks very tricky to spot but your explanation makes sense. One
way to test this possibility would be to update the metadata subtracting the
interval needed for the backup to take place, i.e, use the start time of the
backup procedure.

Are you still getting this warning? Could you test with the following patch?

--- rsync.in  2012-02-25 18:30:55.000000000 -0200
+++ rsync-starttime.in  2012-02-25 19:35:41.000000000 -0200
@@ -829,7 +829,11 @@
   if [ "$dest" == "local" ]; then
     metadata="`dirname $dest_path`/metadata/`basename $dest_path`"
     mkdir -p $metadata
-    date +%c%n%s > $metadata/created
+    # Use the backup start time and not the time the backup was
+    # finished, otherwise daily rotations might not take place.
+    # If we used backup end time, in the next handler run
+    # we might not have $now - $created >= 24:00
+    echo $starttime > $metadata/created
     $touch $backupdir/$SECTION/$suffix
   else
     folder="`echo $dest_path | cut -d : -f 2`"
@@ -839,7 +843,11 @@
   $ssh_cmd <<EOF
     ##### BEGIN REMOTE SCRIPT #####
     mkdir -p $metadata
-    date +%c%n%s > $metadata/created
+    # Use the backup start time and not the time the backup was
+    # finished, otherwise daily rotations might not take place.
+    # If we used backup end time, in the next handler run
+    # we might not have $now - $created >= 24:00
+    echo $starttime > $metadata/created
     ##### END REMOTE SCRIPT #######
 EOF
 ) | (while read a; do passthru $a; done)
@@ -1116,6 +1124,7 @@
   set_dest
 
   info "Syncing $SECTION on $dest_path..."
+  starttime="`date +%c%n%s`"
   debug $nice $rsync "${rsync_options[@]}" $filelist_flag $excludes 
$batch_option $orig $dest_path
   $nice $rsync "${rsync_options[@]}" $filelist_flag $excludes $batch_option 
$orig $dest_path | tee -a $log

-- 
rhatto at riseup.net
pubkey 64E39FCA / keys.indymedia.org

Attachment: signature.asc
Description: Digital signature

Reply via email to