首页 > 其他 > 详细

rsync+inotify

时间:2014-09-22 19:03:54      阅读:301      评论:0      收藏:0      [点我收藏+]

 


192.168.1.88 有文件 /web 要到  192.168.1.189  /web

 

===================192.168.1.88==================================================

[root@192.168.1.88]#tar zxvf inotify-tools-3.14.tar.gz

[root@192.168.1.88]#cd inotify-tools-3.14

[root@192.168.1.88 inotify-tools-3.14]# ./configure --prefix=/usr/local/inotify-tools

[root@192.168.1.88 inotify-tools-3.14]# make && make install


vi /etc/rsyncd.secrets
root:123

 

[root@kk22 ~]# cat inotify.sh

#!/bin/bash

#


host1=192.168.1.189            ##服务器端IP

src=/web/                      ##本地数据存放目录

dst=web                        ##服务端数据的目录

user=root                      ##主机A允许推送拉取数据的用户

 

/usr/local/inotify-tools/bin/inotifywait -mrq  -e modify,delete,create,attrib $src | while read line ; do

/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/rsyncd.passwd $src $user@$host::$dst

done
[root@192.168.1.88 ~]# vi inotify.sh
[root@192.168.1.88 ~]# ./inotify.sh

 


========================192.168.1.189=============================================

yum install xinetd
service xinetd start
chkconfig rsync  on

 


[root@192.168.1.189]# cat /etc/rsyncd.conf
pid file = /var/run/rsyncd.pid
port = 873
uid = root
gid = root
user chroot = yes
read only = no
write only = no
hosts allow=192.168.1.0/255.255.255.0
host deny=*
mac connections = 2
log file = /var/log/rsync.log
log format = %t %a %m %f %b
timeout = 300
[web]
path = /web
list = yes
ignore error
auth user = root
secrets file = /etc/rsyncd.secrets
exclude = 222/

 

vi /etc/rsyncd.secrets
root:123

rsync+inotify

原文:http://setup.blog.51cto.com/36721/1556976

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