How to use RSYNC

Posted: May 26, 2011 in Linux-Scripts, Redhat

How do I use rsync command?

if you would like to sync’d between www1 and www2(master) servers, type the following command on www1 server:rsync -avrR --links --rsh=/usr/bin/ssh WWW2:/var/html/ /var/htmlWhere,

  • -avrR : archive mode (a), verbose (v), recurse into directories (r), use relative path names (R) [ I did not use R in my scripts for simplicity ]
  • –links : copy symlinks as symlinks
  • –delete                delete files that dont exist on master
    –rsh=/usr/bin/ssh : Use to specify the remote shell ssh to use (secure copy).
  • WWW2:/var/html/ : WWW2 server IP address and path to synchronize to www1 server
  • /var/html : WWW1 server path

A sample shell script for same job


rsync -avr --links --delete --rsh=$SSH $MASTER:$DIR $LDIR

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s