服务端配置说明:
#######################################
rsync Server:192.168.0.193
rsync Client:192.168.0.194
#######################################

第一步就是安装:
wget http://down1.chinaunix.net/distfiles/rsync-2.6.9.tar.gz
#tar zxvf rsync-2.6.9.tar.gz
#cd rsync-2.6.9
#./configure --prefix=/usr/local/rsync
#make
#make install

第二步配置
**************************************************************************
rsync Server端:
#vi /etc/rsyncd.conf

  1. #[global]  
  2. strict modesyes    
  3. port873   
  4. logfile= /var/log/rsyncd.log  
  5. pidfile= /var/run/rsyncd.pid  
  6. lock file= /var/log/rsyncd.log  
  7. max connections2 
  8. uidroot 
  9. gidroot 
  10. use chroot =yes 
  11. read only =no   
  12. ignore errors   
  13. hosts allow192.168.0.194  
  14. hosts deny0.0.0.0\0  
  15.  
  16. #[bakcontent]     
  17. path= /home/bakcontent/  
  18. auth usersusername 
  19. ignore errors  
  20. secrets file= /etc/rsyncd.pw  

###################################
指定rsync口令文件:
#vim /etc/rsync.pw

tianzheng:123456  

#cd /etc
#chown root.root rsync.pw
#chmod 600 rsync.pw
#vi /etc/xinetd.d/rsync

  1. service rsync  
  2. {  
  3.        disable = no    #仅修改此处,表示启用这个服务  
  4.        socket_type     = stream      
  5.        wait            = no        
  6.        user            = root    
  7.        server          = /usr/bin/rsync    
  8.        server_args     = --daemon  
  9.        log_on_failure  += USERID  
  10. }  

#chkconfig rsync on
#/usr/bin/rsync --daemon
#vi /etc/rc.local
   加入一行/usr/local/rsync --daemon
/usr/bin/rsync --daemon
**************************************************************************

rsync Client配置:
#vi /etc/rsync.pw
123456
#cd /etc
#chown root.root rsync.pw
#chmod 600 rsync.pw

**************************************************************************

配置完成后
从server端取文件
/usr/bin/rsync -vzrtopg --progress --delete /home/backup --password-file=/etc/rsync.pw
向SERVER端传文档
/usr/bin/rsync -vzrtopg --progress --password-file=/etc/rsync.pw /home/backup

**************************************************************************

自动运行
1)vi /usr/local/rsync/time.sh
#!/bin/bash

  1. /usr/bin/rsync -vzrtopg --progress --delete /home/backup --password-file=/etc/rsync.pw  

2) crontab -e
加入* 1 * * * /usr/local/rsync/time.sh        //每1小时运行一次time.sh脚本文档