inotify+ rsync window同步linux服务器文件夹

这里写图片描述

inotify

功能ok

window 安装 cwRsyncServer

http://www.linuxidc.com/Linux/2014-08/105514.htm

linux 安装rsync

[root@nginx ~]# cd /usr/src/  
[root@nginx src]# ll  
total 16  
drwxr-xr-x 2 root root 4096 Jan 26  2010 debug  
drwxr-xr-x 2 root root 4096 Jan 26  2010 kernels  
[root@nginx src]# wget  http://rsync.samba.org/ftp/rsync/src/rsync-3.0.9.tar.gz  
[root@nginx src]# tar zxvf rsync-3.0.9.tar.gz  
[root@nginx src]# cd rsync-3.0.9  
[root@nginx rsync-3.0.9]# ./configure --prefix=/usr/local/rsync  
[root@nginx rsync-3.0.9]# make  
[root@nginx rsync-3.0.9]# make install  

密码文件

[root@nginx rsync-3.0.9]# cd /usr/local/rsync/  

[root@nginx rsync]# echo "rsync-pwd" >/usr/local/rsync/rsync.passwd   

权限

chmod 600 rsync.passwd 

修改inotify_start.sh脚本

#!/bin/bash  
host=192.168.10.221  
src=/tmp/         
des=web 
user=webuser 
/usr/local/inotify/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e modify,delete,create,attrib $src \  
| while read files  
do  
/usr/bin/rsync -vzrtopg --delete --progress --password-file=/usr/local/rsync/rsync.passwd $src $user@$host::$des  
echo "${files} was rsynced" >>/tmp/rsync.log 2>&1  
done 

ok了

refurl

http://blog.csdn.net/linuxlsq/article/details/51768731

http://www.ttlsa.com/web/let-infotify-rsync-fast/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值