I have the following situation: I have multiple client machines (i.e., client1, client2, client3) and I'd like to keep a certain folder ("/code") synchronized across all machines. Currently, I have an rsync script set up on a seperate server to keep the files synchronized. I.e., on the server, I do something like the following:
# Step 1: update/copy all files from each client to the server
rsync -vrtu client1:/code/ /code
rsync -vrtu client2:/code/ /code
rsync -vrtu client3:/code/ /code
# Step 2: synchronize each client with the server
rsync -vrtu /code/ client1:/code
rsync -vrtu /code/ client2:/code
rsync -vrtu /code/ client3:/code
I run this using cron and it propogates any file updates on one machine to all machines. The problem is that deletions are not propagated. Moreover, if I understand the rsync --delete option correctly, it seems that using --delete would keep any new files from my clients from being added to the server. Is that correct? I would just like to keep the files on all three of my clients completely synchronized (additions, deletions, and modifications). Is there a simple way to do what I want using rsync?