Linux 101: How to Sync Two Folders on Two Hosts

This is a genuine request from a friend of mine who has a website and needs to be backed up in a hot stand-by server in case the production goes down. The command that I am using is ‘rsync’.

Firstly, you’ll have to install rsync on both boxes if you have not done so:

sudo yum install rsync

usually will do the trick

Secondly, I use the following command on the stand-by server to 'back up' all the PROD website's files:

sudo rsync -rtavue ssh [email protected]:/home/wwwroot/default/ /home/wwwroot/default/ --delete

The above command will ask your local password first and then your password on the PROD server. --delete gets rid of all files that no longer exist on the PROD side.

BTW, here is a better tutorial all about ‘rsync’.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *