Sunday, June 19, 2011

Rsync tips


1 Server to Local


1.1 With Interactive Password Entry Prompt

rsync -apvz \
   --recursive \
   --links \
   --perms \
   --times \
   --devices \
   --specials \
   --partial \
   --progress \
   --delete \
   --timeout=300 \
   --exclude='readwrite' \
   --exclude='linux-2.6.30.7'  \
   --exclude='arnold' \
   --exclude='kernels' \
   -e  "ssh " \
       suresh@192.168.0.100:/mnt/boot-images /FC10/boot-images

1.2 With Shared ssh-keys (private)  

rsync -apvz \
   --recursive \
   --links \
   --perms \
   --times \
   --devices \
   --specials \
   --partial \
   --progress \
   --delete \
   --timeout=300 \
   --exclude='readwrite' \
   --exclude='linux-2.6.30.7'  \
   --exclude='arnold' \
   --exclude='kernels' \
   -e  "ssh -i /root/.ssh/id_dsa_rsyncusr -o PreferredAuthentications=publickey -o StrictHostKeyChecking=no" \
     suresh@192.168.0.100:/mnt/boot-images /FC10/boot-images 

Local to Server 

rsync -apvz \
   --recursive \
   --links \
   --perms \
   --times \
   --devices \
   --specials \
   --partial \
   --progress \
   --delete \
   --timeout=300 \
   --exclude='readwrite' \
   --exclude='linux-2.6.30.7'  \
   --exclude='arnold' \
   --exclude='kernels' \
   -e  "ssh " \
      /var/www/html suresh@192.168.0.100:/mnt/backup
Two-Way-Sync 
rsync -apvz \
   --update \
   --recursive \
   --links \
   --perms \
   --times \
   --devices \
   --specials \
   --partial \
   --progress \
   --delete \
   --timeout=300 \
   --exclude='readwrite' \
   --exclude='linux-2.6.30.7'  \
   --exclude='arnold' \
   --exclude='kernels' \
   -e  "ssh " \
      /var/www/html suresh@192.168.0.100:/mnt/backup