欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

sersync2 完全安裝配置說明(三) 插件基本配置和使用

 更新時(shí)間:2011年11月29日 11:04:01   作者:  
sersync2 完全安裝配置說明(三) 插件基本配置和使用,需要的朋友可以參考下。
插件相關(guān)xml
復(fù)制代碼 代碼如下:

<sersync>
......
<plugin start="false" name="command"/>
</sersync>
<plugin name="command">
<param prefix="/bin/sh" suffix="" ignoreError="true"/>
<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>

如上面的xml所示,其中plugin標(biāo)簽設(shè)置為true時(shí)候,在同步文件或路徑到遠(yuǎn)程之后后,調(diào)用插件。通過name參數(shù)指定需要執(zhí)行的插件。目前支持的有command refreshCDN socket http四種插件。http插件目前由于兼容性原因去除,以后會(huì)重新加入。
以下模塊(command refreshCDN http socket)可以單獨(dú)使用(發(fā)生文件改變不同步只調(diào)用插件),只需在命令行下使用-m 參數(shù)即可。如果需要作為插件與同步程序一起使用,見同步程序說明的插件配置。
command插件
當(dāng)文件同步完成后,會(huì)調(diào)用command插件,如同步文件是test.php,則test.php文件在改動(dòng)之后,調(diào)用rsync同步到遠(yuǎn)程服務(wù)器后,調(diào)用command插件,執(zhí)行
復(fù)制代碼 代碼如下:

/bin/sh test.php suffix >/dev/null 2>&1

如果suffix 設(shè)置了,則會(huì)放在inotify事件test.php之后
如果ignoreError為true,則會(huì)添加>/dev/null 2>&1
當(dāng)然還可以設(shè)置command的filter,當(dāng)filter為ture,include可以只對正則匹配到的文件,調(diào)用command。
“refreshCDN”,就在同步過程中將文件發(fā)送到目 的服務(wù)器后刷新cdn接口。如果不想使用,則將start屬性設(shè)為false即可。如果需要使用其他插件,則查看其他plugin標(biāo)簽,將插件名稱改為 xml中其它插件的名稱即可。該模塊根據(jù)chinaCDN的協(xié)議,進(jìn)行設(shè)計(jì),當(dāng)有文件產(chǎn)生的時(shí)候,就向cdn接口發(fā)送需要刷新的路徑位置。刷新CDN模塊需要配置的xml文件如下。
復(fù)制代碼 代碼如下:

<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>

其中 localpath watch 是需要監(jiān)控的目錄。
cdnifo標(biāo)簽制定了cdn接口的域名,端口號(hào),以及用戶名與密碼。
sendurl標(biāo)簽是需要刷新的url的前綴。
regexurl標(biāo)簽中的,regex屬性為true時(shí)候,使用match屬性的正則語句匹配inotify返回的路徑信息,并將正則匹配到的部分作為url一部分,
舉例:
如果產(chǎn)生文件事件為:/data0/htdoc/cms.xoyo.com/site/jx3.xoyo.com/image/a/123.txt
經(jīng)過上面的match正則匹配后,最后刷新的路徑是:
http://pic.xoyo.com/cms/jx3/a/123.txt;
如果regex屬性為false,最后刷新的路徑是
http://pic.xoyo.com/cms/jx3.xoyo.com/images/a/123.txt;
socket插件
socket插件,開啟該模塊,則向指定ip與端口發(fā)送inotify所產(chǎn)生的文件路徑信息。
Http插件
http插件,可以向指定域名的主機(jī)post,inotify監(jiān)控的事件。


單獨(dú)運(yùn)行插件
插件也可以單獨(dú)使用,即不對遠(yuǎn)程目標(biāo)機(jī)進(jìn)行同步,直接調(diào)用插件:
只調(diào)用command插件
./sersync -d -m command只調(diào)用refreshCDN插件
./sersync -d -m refreshCDN只調(diào)用socket插件
./sersync -d -m socket只調(diào)用http插件
./sersync -d -m http

相關(guān)文章

最新評論