Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to replicate a folder over a very slow link to several destinations.

Currently I create a text file with find.

find "$sourcedir" -exec ls -la {} \; > "$statefile"

I then compare it to a previous file created the same way to determine whether the script should exit or perform a few rsyncs. In the end the new statefile becomes the old statefile for next time the script runs.

if ! diff "$statefile" "$statefile".old 

Is there a better way minimising resource usage on source? (Compatible with bash on Debian.)

Should I just run the first rsynd and after changes, do the rest? How do I tell whether rsync has actually modified any files after the first rsync?

share|improve this question

You want to reduce the resources used by find, ls and diff? Must be a huge amount of files for that becoming relevant I would guess...

You can obviously save a lot of ls calls by using -exec ... + instead of -exec ... ;. And you can consider getting rid of ls at all as it does nothing find cannot do itself. You may generate the file with find's printf values, creating more or less the same output. But: Neither ls nor find detect certain ACL and extended attribute changes.

A completely different approach: FAM (File Alteration Monitor). You let the kernel tell you (via e.g. fileschanged) what has (possibly) changed.

One more hint: Something like rdiff-backup should need less bandwidth than rsync because

  1. the checks are done locally
  2. the checks are done onyce only and not again for every target
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.