installation
tar zxvf rsync-2.6.8.tar.gz
cd rsync-2.6.8
./configure && make && make install
 
configuration
vi /etc/rsyncd.conf
#[globale]
strict modes= yes
port= 873
logfile= /var/log/rsyncd.log
pidfile= /var/run/rsyncd.pid
lock file= /var/run/rsync.lock
max connections= 4
secrets file= /etc/rsyncd.share

#[modules]
[appdata]
uid= root
gid= root
path= /data
read only= no
list= yes
host allow= *
auth users= tianzy
 
vi /etc/rsyncd.share
tianzy:abc123
 
start in the background
rsync --daemon --config=/etc/rsyncd.conf &
 
client configuration
vi /etc/rsyncd.share
abc123
 
client sync command
rsync -vzrtopg --progress --password-file=/etc/rsyncd.share tianzy@192.168.0.100::appdata /app_bak/bakdir/
 
-----------------------------------------------------------------------------------
--progress   show progress during transfer
--password-file=FILE   read password from FILE
--delete   delete files that don't exist on the sending side
-v,  --verbose increase verbosity
-o,  --owner preserve owner (super-user only)
-g,  --group preserve group
-t,   --times preserve times
-z,   --compress compress file data during the transfer
-p,  --perms preserve permissions
-----------------------------------------------------------------------------------
 
client crontab
crontab -e

  0 2 */1 * * rsync -vzrtopg --progress --password-file=/etc/rsyncd.share tianzy@192.168.0.100::appdata /app_bak/bakdir/