Pages

Bài đăng phổ biến

Tuesday, November 8, 2011

Sync data two server by rsync

Example

rsync -avrR --links --rsh=/usr/bin/ssh IP:/var/html/ /var/html
Go Daddy $7.49 .com Sale!


Where,
  • -avrR : archive mode (a), verbose (v), recurse into directories (r), use relative path names (R)
  • --links : copy symlinks as symlinks
  • --rsh=/usr/bin/ssh : Use to specify the remote shell ssh to use (secure copy).
  • IP:/var/html/ : WWW2 server IP address and path to synchronize to www1 server
  • /var/html : WWW1 server path
A small script:

#!/bin/bash
MASTER="master-server-ip"
DIR="/var/www/change-me"
LDIR="/local/dir"
SSH="/usr/bin/ssh"
rsync -avrR --links --rsh=$SSH $MASTER:$DIR $LDIR


Source: cybercit

No comments:

Post a Comment

Thanks for your join,we will be reply to you asap.