This shows you the differences between two versions of the page.
rsync [2010/10/05 23:48] k2patel |
rsync [2020/08/10 02:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Rsync ====== | ||
- | with status and Common variable | ||
- | <code bash> | ||
- | rsync --verbose --progress --stats --compress --recursive --times --perms --links <source> <destination> (location is defined as [hostname]::path) | ||
- | </code> | ||
- | ==== SSH Wrapper ==== | ||
- | SSH Wrapper allows to transfer files using rsync over SSH.\\ | ||
- | Mostly usefull when dont have Rsyncd not running and have only access over ssh. | ||
- | <code bash> | ||
- | rsync -av -e "ssh -l testet" <source> <destination> | ||
- | </code> | ||
- | |||
- | ==== Limit Bandwidth / Disk I/O ==== | ||
- | |||
- | To limit bandwidth when transferring over Network.\\ | ||
- | OR\\ | ||
- | Limit Disk I/O when transferring between Disk.\\ | ||
- | Use "--bwlimit" switch. it is measured as "KBytes" | ||
- | |||
- | Following example limit 100 MB/s | ||
- | <code bash> | ||
- | rsync -avgop --progress --bwlimit=102400 /mnt/drive1 /mnt/driv2 | ||
- | </code> | ||
- | |||
- | ==== General rsync Commands ==== | ||
- | |||
- | |||
- | ==== Authenticated Rsync ==== | ||
- | |||
- | define rsync mount point in rsyncd.conf | ||
- | <code bash | rsyncd.conf> | ||
- | [root] | ||
- | path = /srv/www/htdocs | ||
- | secrets file = /etc/rsyncd/rsync.secret | ||
- | auth users = htdocs | ||
- | read only = false | ||
- | write only = true | ||
- | list = false | ||
- | </code> | ||
- | |||
- | <code text | rsync.secret> | ||
- | rsyncusr:password123 | ||
- | </code> | ||
- | |||
- | |||
- | **NOTE :** | ||
- | * Password is clear text password. | ||
- | * Make sure password file is not world readable else it will fail to authenticate. | ||
- | |||
- | |||
- | Define script for rsync OR run it from command line. | ||
- | |||
- | <code bash | rsync_test.sh> | ||
- | #!/bin/sh | ||
- | |||
- | export RSYNC_PASSWORD=password123 | ||
- | /usr/local/bin/rsync -az --delete --exclude='.*' /srv/www/htdocs/ rsync://rsyncusr@rsync.host.com/root/ | ||
- | |||
- | </code> |