rsync服务

[b]一.服务器端的配置[/b]
1.编辑/etc/rsyncd.conf文件,如果没有则新建一个

uid = nobody
gid = nobody
use chroot = no
read only = yes
timeout = 600
max connections = 40
hosts allow =192.168.1.0/24
secrets file = /etc/rsyncd.secrets
#motd file = /etc/rsyncd.motd
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

[rsync_grade]
path=/opt/vote/inc
comment=my rsync site


2.启动服务(如开有防火墙请允许873端口通过)
/usr/bin/rsync --daemon --config=/etc/rsyncd.conf


3.停掉rsync
要 Kill rsync 进程,不要用 kill -HUP {PID} 的方式重启进程。
ps -ef|grep rsync|grep -v grep|awk '{print $2}'|xargs kill -9

也可以用
cat /var/run/rsyncd.pid | xargs kill -9



4.增加开机启动
在 /etc/rc.local 增加 /usr/bin/rsync --daemon --config=/etc/rsyncd.conf

5.客户端使用
1)客户端--->>服务端 (推) 客户端向服务器端推送文件
--delete参数会删除服务器端中在客户端中没有的文件
/usr/bin/rsync -vrtup -R --delete /inc root@192.168.1.10::rsync_grade


2)客户端--->>服务端 (取) 客户端到服务端取文件
--delete参数会删除客户端中在服务器端中没有的文件
/usr/bin/rsync -vrtup -R --delete root@192.168.1.10::rsync_grade /inc
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值