Search code examples
rsync

rsync running at the same time on two machines


I would like to set up rsync to run on two machines.

Machine A rsync to Machine B
Machine B rsync to Machine A

Would there be any risk of running rsync in two machines at the same time, synching the same files?


Solution

  • If you're very careful you can do it:

    1. Ensure that you use --times so that the time stamps always match, and --update so that it will not overwrite newer versions.

    2. Use --temp-dir with a directory outside the synced tree so that rsync does not find any temp files during its scan. The temporary directory should be on the same file-system as the destination, however, or else atomic moves won't be possible.

    3. Do not use --inplace, any variant of --delete, or --checksum.

    Even then, I would always do it first one way, and then the other, or use a tool like SyncThing.