目次

lsyncd

https://github.com/axkibe/lsyncd
https://github.com/axkibe/lsyncd/wiki/Manual%20to%20Lsyncd%202.1.x

Install

# yum install lsyncd rsync
~省略~
=========================================================================================
 パッケージ         アーキテクチャ     バージョン                 リポジトリー      容量
=========================================================================================
インストールしています:
 lsyncd             x86_64             2.1.5-0.el6                epel              73 k

トランザクションの要約
=========================================================================================
インストール         1 パッケージ
~省略~
インストール:
  lsyncd.x86_64 0:2.1.5-0.el6                                                            

完了しました!

Configuration

# cp -a /etc/lsyncd.conf /etc/lsyncd.conf.org
# vi /etc/lsyncd.conf
----
-- User configuration file for lsyncd.
--
-- Simple example for default rsync, but executing moves through on the target.
--
-- For more examples, see /usr/share/doc/lsyncd*/examples/
-- 
-- sync{default.rsyncssh, source="/var/www/html", host="localhost", targetdir="/tmp/htmlcopy/"}


settings {
    logfile = "/var/log/lsyncd/lsyncd.log",
    statusFile = "/var/log/lsyncd/lsyncd-status.log",
    statusInterval = 1
}

sync {
    default.rsync,
    delay = 0,
    source="/usr/share/nginx/html/ab",
    target="web02:/usr/share/nginx/html/ab"
}

sync {
    default.rsync,
    delay = 0,
    source="/usr/share/nginx/html/ab",
    target="web03:/usr/share/nginx/html/ab"
}

Service start

# /etc/init.d/lsyncd start