1.软件安装 2.编写配置 <?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5">
<host hostip="localhost" port="8008"></host>
<!--debug 模式打印 -->
<debug start="false"/>
<!--xfs 文件系统开关 -->
<fileSystem xfs="false"/>
<!--#过滤文件 true开启 false关闭 相对于rsync 过滤的文件不会被监控,加大性能 -->
<filter start="false">
<exclude expression="(.*)\.svn"></exclude>
<exclude expression="(.*)\.gz"></exclude>
<exclude expression="^info/*"></exclude>
<exclude expression="^static/*"></exclude>
</filter>
<inotify>
<delete start="true"/> <!--#监控文件或目录的删除 -->
<createFolder start="true"/> <!--#监控目录的创建 -->
<createFile start="false"/> <!--#监控文件创创建事项的修改 -->
<closeWrite start="true"/> <!-- #监控文件关闭的事件的修改 两者只需要一个 -->
<moveFrom start="true"/> <!--#监控文件移动 -->
<moveTo start="true"/> <!--#监控文件移动 -->
<attrib start="false"/> <!--#监控文件属组改变 -->
<modify start="false"/> <!--#监控文件权限 -->
</inotify>
<sersync>
<!--#设置监控的目录 watch-->
<!--##指定目标主机的IP地址remote ip=和模块名name[名称](和samba的类似,不是目录的名称)-->
<localpath watch="/application/tomcat7/webapps/TZ">
<remote ip="192.168.5.120" name="sign_xml"/>
</localpath>
<rsync>
<!-- #指定rsync 运行时的参数,可根据自身需要更改-->
<commonParams params="-aruz"/>
<!-- #启用验证,指定用户名和密码文件(只用写一个密码即可) -->
<!-- #用户名是目标服务器上rsync配置文件中指定的用户名,密码文件中的密码也目标服务器上rsync指定的密码文件指定的密码-->
<auth start="true" users="root" passwordfile="/etc/eisp_rsync/rsync.password"/>
<userDefinedPort start="false" port="874"/><!-- port=874 -->
<!--超时 timeout=100 -->
<timeout start="true" time="100"/>
<ssh start="false"/>
</rsync>
<!--#指定错误的日志文件路径-->
<failLog path="/usr/local/sersync/logs/eisp_signatrue_rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->
<crontab start="false" schedule="600"><!--600mins-->
<crontabfilter start="false">
<exclude expression="*.php"></exclude>
<exclude expression="info/*"></exclude>
</crontabfilter>
</crontab>
<plugin start="false" name="command"/>
</sersync>
<plugin name="command">
<param prefix="/bin/sh" suffix="" ignoreError="true"/><!--prefix /opt/tongbu/mmm.sh suffix-->
<filter start="false">
<include expression="(.*)\.php"/>
<include expression="(.*)\.sh"/>
</filter>
<!--#插件模式-->
</plugin>
<plugin name="socket">
<localpath watch="/opt/tongbu">
<deshost ip="192.168.138.20" port="8009"/>
</localpath>
</plugin>
<plugin name="refreshCDN">
<localpath watch="/data0/htdocs/cms.xoyo.com/site/">
<cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/>
<sendurl base="http://pic.xoyo.com/cms"/>
<regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/>
</localpath>
</plugin>
</head>
<?xml version="1.0" encoding="ISO-8859-1"?> <head version="2.5"> <host hostip="localhost" port="8008"></host> <!--debug 模式打印 --> <debug start="false"/> <!--xfs 文件系统开关 --> <fileSystem xfs="false"/> <!--#过滤文件 true开启 false关闭 相对于rsync 过滤的文件不会被监控,加大性能 --> <filter start="false"> <exclude expression="(.*)\.svn"></exclude> <exclude expression="(.*)\.gz"></exclude> <exclude expression="^info/*"></exclude> <exclude expression="^static/*"></exclude> </filter> <inotify> <delete start="true"/> <!--#监控文件或目录的删除 --> <createFolder start="true"/> <!--#监控目录的创建 --> <createFile start="false"/> <!--#监控文件创创建事项的修改 --> <closeWrite start="true"/> <!-- #监控文件关闭的事件的修改 两者只需要一个 --> <moveFrom start="true"/> <!--#监控文件移动 --> <moveTo start="true"/> <!--#监控文件移动 --> <attrib start="false"/> <!--#监控文件属组改变 --> <modify start="false"/> <!--#监控文件权限 --> </inotify> <sersync> <!--#设置监控的目录 watch--> <!--##指定目标主机的IP地址remote ip=和模块名name[名称](和samba的类似,不是目录的名称)--> <localpath watch="/application/tomcat7/webapps/TZ"> <remote ip="192.168.5.120" name="sign_xml"/> </localpath> <rsync> <!-- #指定rsync 运行时的参数,可根据自身需要更改--> <commonParams params="-aruz"/> <!-- #启用验证,指定用户名和密码文件(只用写一个密码即可) --> <!-- #用户名是目标服务器上rsync配置文件中指定的用户名,密码文件中的密码也目标服务器上rsync指定的密码文件指定的密码--> <auth start="true" users="root" passwordfile="/etc/eisp_rsync/rsync.password"/> <userDefinedPort start="false" port="874"/><!-- port=874 --> <!--超时 timeout=100 --> <timeout start="true" time="100"/> <ssh start="false"/> </rsync> <!--#指定错误的日志文件路径--> <failLog path="/usr/local/sersync/logs/eisp_signatrue_rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once--> <crontab start="false" schedule="600"><!--600mins--> <crontabfilter start="false"> <exclude expression="*.php"></exclude> <exclude expression="info/*"></exclude> </crontabfilter> </crontab> <plugin start="false" name="command"/> </sersync> <plugin name="command"> <param prefix="/bin/sh" suffix="" ignoreError="true"/><!--prefix /opt/tongbu/mmm.sh suffix--> <filter start="false"> <include expression="(.*)\.php"/> <include expression="(.*)\.sh"/> </filter> <!--#插件模式--> </plugin> <plugin name="socket"> <localpath watch="/opt/tongbu"> <deshost ip="192.168.138.20" port="8009"/> </localpath> </plugin> <plugin name="refreshCDN"> <localpath watch="/data0/htdocs/cms.xoyo.com/site/"> <cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/> <sendurl base="http://pic.xoyo.com/cms"/> <regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/> </localpath> </plugin> </head>
查看更多关于Linux服务器centos多个文件目录实现同步rsync的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did21029