Help with rsync configuration
Matt McCutchen
hashproduct+rsync at gmail.com
Sat Jan 6 20:39:36 GMT 2007
On 1/5/07, Vinicius Carvalho <java.vinicius at gmail.com> wrote:
> 6)modified the file on node A (the one from node B)
> 7)node A ran the script before node B, so it got the version from B
> (which was older then the one on A)
Right...if the scripts notice that a file differs between node A and
node B, they need some way of deciding which machine's version of the
file to keep.
The --update option tells rsync to skip transferring a regular file
from the source if the destination file is a newer regular file. If
all the scripts used this option, then rsync in step 7 would have
noticed that the destination file (on A) was newer than the source
file (on B) and would have done nothing. Then, when node B ran the
script, it would pull the updated version from A. As a result,
whenever two files differed, the one with the newer modification time
would be kept.
This is a 90% solution. I use it to synchronize my school assignments
between my computer and my school's server, and it works OK for my
purposes. However, it has some disadvantages:
(1) If you change file attributes or overwrite a file with another
file of a different type (e.g., regular file -> directory), the change
could be reversed if the changed machine happens to run the script
first.
(2) It does not understand deletions: if you delete a file from one
node, that node will receive it again from the other node. If you add
the --delete option, a file creation might be reversed, which is even
worse.
(3) If you modify a file on both machines in between script runs, the
newer file overwrites the older one with no warning.
(4) If both machines happen to run the script at the same time, each
script's temporary files could confuse the other script.
To overcome these problems, you need a real two-way synchronization
tool such as Unison ( http://www.cis.upenn.edu/~bcpierce/unison/ ) or
a network filesystem such as AFS.
Matt
More information about the rsync
mailing list