System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use rsync bidirectional between two servers?

Can I use rsync bidirectional between two servers?

Hello,

I would like to know if I could use "rsync" bidirectional and if you have the exact configuration assuming you have rsync and ssh already installed on both servers. If you could help me on this, I would really appreciated.
Reynaldo Torres
2 REPLIES
Thierry D
Valued Contributor

Re: Can I use rsync bidirectional between two servers?

Hi Reynaldo

I dont really know how to do it with rsync but it should be possible.

You may want to look at "dsync" which does it.
I used it a really while ago and it workd fine. It is based on rsync if I remember well (thats why I said it must be possible with rsync).


Here have a look at the link.

http://www.ayradyss.org/programs/man/dsync.html

Regards,
Thierry
Matti_Kurkela
Honored Contributor

Re: Can I use rsync bidirectional between two servers?

On modern Linux systems, rsync usually uses ssh by default.

To bidirectionally sync a directory /src/foo on hostA to /dest/foo on hostB, including all the sub-directories, you would run these commands on hostA:

rsync -auz /src/foo hostB:/dest
rsync -auz hostB:/dest/foo /src

The first command pushes all the files that are newer on hostA to hostB. The second command will pull all the files that are newer on hostB to hostA. The critical options are:
- when copying, you must preserve file modification times. "-a" does this and other things; if you want to preserve just the modification times, use "-t" instead.
- you must skip any files that are newer on the destination: "-u" does this.

Alternatively, you could do the same thing from hostB:

rsync -auz hostA:/src/foo /dest
rsync -auz /dest/foo hostA:/src

MK
MK