How does rsync handle the possibility of interference with another rsync on the same machine? I have read all the documentation I can find but do not see any mention of this. I am going to run some experiments but am concerned that they may not reveal the full extent of any problems I might run into.
Here is the scenario. I want to keep two machines in sync. Each machine monitors for file changes in a directory, and when it detect some, it runs rsync to sync that directory to the remote machine. Normally, only one machine at a time will have a file changes occurring, but what would happen if the same file changed on both machines at the same time, presumably to something different? Will rsync detect that it is running on both machines and correctly handle the situation (e.g. sync only the newer file over) or could it go horribly wrong resulting in corruption or indeterminate behavior?
Will the outcome be different if there is an rsync server on each machine versus using ssh? I haven't seen any good explanation of the benefits to using one method versus the other.