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

来源:互联网 发布:如何专卖自己的域名 编辑:程序博客网 时间:2024/06/20 00:18

这里写图片描述

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/

原创粉丝点击