xxxxxxxxxx
rsync -azvv -e "ssh -i ~/.ssh/dhavalparekh93com.pem" ~/rankmathdemo.xml ubuntu@15.207.96.83:/home/ubuntu/temp
rsync -azvv -e "ssh -i ~/.ssh/dhavalparekh93com.pem" ~/local.sql ubuntu@15.207.96.83:/home/ubuntu/temp
rsync -azvv -e "ssh -i [PATH_TO_PEM_FILE]" [SOURCE_LOCATION] [DESTINATION]
rsync -azvv -e "ssh -i ~/.ssh/PEM_FILE.pem" ~/local.sql ubuntu@xx.xxx.xx.xx:/home/ubuntu/temp
xxxxxxxxxx
The rsync command stands for Remote Synchronization.
The Linux command rsync is used to do a backup operation and fast copy file into the local system or remote system in UNIX/Linux.
rsync command examples
# rsync options source destination
$ rsync – zvr /var/www/website/ /root/tmp
$ rsync –avz /root/temp/ linuxconcept@192.168.5.111:/home/linuxconcept/temp/
$ rsync –avz linuxconcept@192.168.5.111:/var/lib/mysql /root/temp
This will sync /somefolder folder from remoteserver.com to local server.
xxxxxxxxxx
rsync -pavz root@remoteserver.com:/home/somefolder /home/
If you want to run as cron job and need password you can run like this
xxxxxxxxxx
/usr/bin/sshpass -p "somepass" /usr/bin/rsync -pavz root@remoteserver.com:/somefolder /home/
xxxxxxxxxx
we use rsync to perform the backup process in Linux/UNIX.
$ rsync –zvr /home/linuxconcept/newweb/ /var/www/linuxconcept/
$ ls –l /home/linuxconcept/newweb/index.html /var/www/linuxconcept/index.html
$ rsync –zva /home/linuxconcept/newweb/ /var/www/linuxconcept/
$ rsync –v /etc/ssl/linuxconcept/pubkeys /home/linuxconcept/pubkeys
$ rsync -avz /root/temp/ linuxconcept@192.168.2.10:/home/linuxconcept/temp/
$ rsync -avz linuxconcept@192.168.2.10:/home/linuxconcept/satish /root/temp
$ rsync -avz -e ssh linuxconcept@192.168.2.10:/home/linuxconcept/satish /root/temp
$ rsync -avzhe ssh –progress /home/linuxconcept linuxconcept@192.168.2.10:/root/rpmpkgs
$ rsync –avz – -delete linuxconcept@192.168.2.10:/home/linuxconcept/ .
$ rsync –avzhe ssh – -max-size=’400k’ /home/linuxconcept/satish/ linuxconcept@192.168.2.10:/home/linuxconcept/tmp
xxxxxxxxxx
#from hpc to local
rsync -chavzP --stats user@remote.host:/path/to/copy /path/to/local/storage
#local to hpc
rsync -chavzP --stats /path/to/local/storage user@remote.host:/path/to/copy
xxxxxxxxxx
rsync -a -m --include='*.txt' --include='*/' --exclude='*' source_dir/ destination_dir/
#this will copy with folder structure.