File locking for simultaneous rsync sessions

Andrew Culver aculver at uwo.ca
Thu Feb 14 18:51:38 GMT 2008


Hello all,

I have two web servers both mounting the same file system (with GFS). I 
have a third web server which is independent from the first two, using 
only its own local file systems. I need to mirror a directory within the 
shared file system on the first two web servers to the local file system 
on the third web server. To maintain redundancy, both of the first two 
web servers will be pushing the files to the third web server via rsync 
started up by cron as well as on-demand by the web developers.

My concern is that if rsync is running on the first two web servers at 
the same time, that there may be a chance for the two rsync sessions to 
write to the same file(s) on the third web server at the same time, 
possibly corrupting the files or interrupting the transfers.

Is there any sort of locking mechanism built in into rsync to prevent 
this from happening? Would running an rsync daemon on the third web 
server versus running it under an ssh shell make any difference to this? 
Has anyone else worked around this type of problem before and what 
solution did you use? I was thinking of having the scripts on the first 
two web servers refer to a lock file before firing up rsync, but was 
hoping there was something built in to rsync to avoid this added complexity.

Thanks in advance for any advice,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3225 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.samba.org/archive/rsync/attachments/20080214/f887a2e5/smime.bin


More information about the rsync mailing list