I'm  using rsync to update my local database snapshot from a remote pooled 
mirror server.  
The trouble is that the servers in the pool are sometimes out of date, so I 
only want to update 
when the files are newer than the local copies to avoid unnecessary I/O..


Originally I copied my existing database to a new directory, and updated that:
  cp -r <current> <new>
  rsync --update, <mirror> <new>
  mv <new> <current>
That worked fine, but then I noticed --inplace, and realized my copy to the new 
directory should 
be redundant.  So I tried:
  rsync --compare-dest=<current> --mkpath --update <mirror> <new>
  [ -e <new/stuff> ] && mv <new> <current>
Which appeared to work, except it sometimes get backdated!  My current hack is 
to change 
the second line to
  [ <new/stuff> -nt <current/stuff> ] && mv <new> <current>
but it's already wasted downloading the old stuff.


Exact reading of the docs says that --update compares source and target dates, 
so I guess it 
looks in the empty <new> rather than <current>.  I can see it's justified, but 
unexpected.


(For the curious, the snapshot is a Gentoo portage tree, about 75 MB in a 
single file, so it's 
worth trying to avoid unnecessary IO.)
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to