Rsync
Task : Copy file dari local computer ke remote server
Copy file from /www/backup.tar.gz ke remote server called openbsd.nirwan.net
$ rsync -v -e ssh /www/backup.tar.gz nirwan@openbsd.nirwan.net:~
Output:
Password:
sent 19099 bytes received 36 bytes 1093.43 bytes/sec
total size is 19014 speedup is 0.99
Please note that symbol ~ indicate the users home directory (/home/nirwan).
Task : Copy file dari remote server ke local computer
Copy file /home/nirwan/webroot.txt dari remote server openbsd.nirwan.net ke local computer /tmp directory:
$ rsync -v -e ssh nirwan@openbsd.nirwan.net:~/webroot.txt /tmp
Password
Task: Synchronize a local directory dengan remote directory
$ rsync -r -a -v -e “ssh -l nirwan” –delete openbsd.nirwan.net:/webroot/ /local/webroot
Task: Synchronize a remote directory dengan local directory
$ rsync -r -a -v -e “ssh -l nirwan” –delete /local/webroot openbsd.nirwan.net:/webroot
Task: Synchronize a local directory dengan remote rsync server
$ rsync -r -a -v –delete rsync://rsync.nirwan.net/cvs /home/cvs
Task: Mirror a directory antara my “old” dan “new” web server/ftp
You can mirror a directory between my “old” (my.old.server.com) and “new” web server with the command (assuming that ssh keys are set for password less authentication)
$ rsync -zavrR –delete –links –rsh=”ssh -l vivek” my.old.server.com:/home/lighttpd /home/lighttpd
rsync command common options
- –delete : delete files that don’t exist on sender (system)
- -v : Verbose (try -vv for more detailed information)
- -e “ssh options” : specify the ssh as remote shell
- -a : archive mode
- -r : recurse into directories
- -z : compress file data
Filed under: Weblogs | Leave a Comment
No Responses Yet to “Rsync”