Thursday, February 22, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 39515  / 3 Years ago, fri, september 3, 2021, 8:23:23

I want to synchronize a directory on the server A to a server B.



On the server A I created a file rsyncd.conf with the content:



uid             = rsync
gid = rsync
use chroot = no
pid file = /var/run/rsyncd.pid

[share]
comment = share
path = /etc/dirtosync
read only = false
list = yes
hosts allow = *
auth users = rsync
secrets file = /etc/rsyncd.secrets


And I created on the server A the file /etc/rsyncd.secrets with the content:



rsync:rsync


I also created on the server A the pid file, and the user rsync with the password rsync.



On the server A, on the file: /etc/default/rsync I put the value RSYNC_ENABLE to true and I started the rsync daemon with the command:



/etc/initd/rsync start


On the server A and the server B the owner and the group of the directory is rsync.



I launched on the machine B the command:



rsync -avzr rsync@<serverA>:/etc/dirtosync/* /etc/dirtosync/


I also tried on the server A the command



rsync -avzr /etc/dirtosync/* rsync@<serverB>:/etc/dirtosync/


With this two commands the result is the same: the files are synchronized just one time when I launch the command but after if I modify the files in the server A they aren't synchronize to the server B



Do I have to do something else to keep the file synchronized?


More From » sync

 Answers
0

You misunderstand how rsync works. rsync does not automatically replicate changes - it is not like dropbox or similar software. rsync only synchronises files once each time it is run. If you want to synchronise more often, then put the rsync command in a cron script (eg. look in /etc/cron.daily). If you want something that automatically synchronises changes, like dropbox does, then look at a different project, such as Sparkle Share or ownCloud.


[#25403] Sunday, September 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sharall

Total Points: 407
Total Questions: 127
Total Answers: 121

Location: Saint Helena
Member since Fri, Mar 26, 2021
3 Years ago
;