首页 > 其他 > 详细

rsync 的安装

时间:2014-02-28 07:26:50      阅读:453      评论:0      收藏:0      [点我收藏+]

Server setup

    0)vi /etc/xinetd.d/rsync
    and ensure following:
    
    disable = no
    
    1)vi /etc/rsyncd.conf
    --------------
    
    uid = nobody
    gid = nobody
    use chroot = no
    max connections = 50
    port = 873
    address = 0.0.0.0
    log file = /var/log/rsyncd.log
    pid file = /var/run/rsyncd.pid
    #hosts allow = 1.2.3.123/32
    
    [main]
    path = /data/upload
    comment = main server data dir
    read only = yes
    dont compress = *.gz *.tgz *.zip *.z *.bz2 *.tbz
    auth users = imguser
    secrets file = /etc/rsyncd.users
    
    *************************
    
    2)
    echo ‘imguser:1234‘ >> /etc/rsyncd.users
    chmod 600 /etc/rsyncd.users  #important!can‘t use 777 or 700,otherwise will happen---auth failed on module
    
    3)
    yum -y install xinetd
    chkconfig  xinetd on
    chkconfig  sshd on
    
    service xinetd restart
    service sshd restart
    netstat -ano|grep :873
    
    4)
    setsebool -P rsync_disable_trans on

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

Client setup

rsync -avz imguser@10.68.229.204::cms /data/upload/

vi /data/run.rsync.cms

#!/bin/bash
if [ `netstat -anp | grep rsync | wc -l` -gt 0
 ] ; then
echo "Prev rsync still running. Skip now. `date`" >> /var/log/rsyncd-messages.log
exit 1
else
RDIR=‘main/‘
LDIR=‘/data/upload/‘
RADD=‘10.68.229.204‘
BAKUSER=‘imguser‘
PROG=‘/usr/bin/rsync‘
OPTIONS=‘-arHvz --checksum‘
export RSYNC_PASSWORD=‘1234‘
$PROG $OPTIONS $BAKUSER@$RADD::$RDIR $LDIR
fi

6)

crontab -e

#sync every 5 seconds.
*/1 * * * * sleep 5 && /data/run.rsync.cms

refer: http://m.oschina.net/blog/91042

rsync 的安装,布布扣,bubuko.com

rsync 的安装

原文:http://www.cnblogs.com/youcanwin/p/3571334.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!