yumでlsyncdをインストールしたらpassword_fileが使えなくて困ったのでコンパイルしてインストールしたときのメモ。
yum -y install asciidoc lua-devel
cd wget https://lsyncd.googlecode.com/files/lsyncd-2.1.4.tar.gz tar xvf lsyncd-2.1.4.tar.gz cd lsyncd-2.1.4 vi default-rsync.lua
rsync.checkgauge = { rsync = { password_file = true, (この行を追加)
./configure make make install
vi /etc/lsyncd.conf
settings{ logfile = "/var/log/lsyncd.log", statusFile = "/var/log/lsyncd.stat", statusInterval = 5, } sync{ default.rsync, source = "/var/www/html/dir1", target = "username@210.188.195.8::dir1", rsync = { archive = true, compress = true, password_file = "/etc/rsyncc.passwd" } }
vi /etc/rsyncc.passwd
password
chmod 600 /etc/rsyncc.passwd
vi /etc/init.d/lsyncd
#!/bin/bash #chkconfig: - 82 12 #description: lsyncd RETVAL=0 prog="/usr/local/bin/lsyncd" pidfile="/var/run/lsyncd.pid" conf="/etc/lsyncd.conf" . /etc/rc.d/init.d/functions start() { echo -n "Starting $prog:" daemon $prog $conf RETVAL=$? echo "" [ $RETVAL = 0 ] && touch $pidfile return $RETVAL } stop() { echo -n "Stopping $prog:" killproc $prog RETVAL=$? echo "" rm -f $pidfile return $RETVAL } case $1 in start) start ;; stop) stop ;; restart) stop && start ;; status) status lsyncd RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac
chmod 755 /etc/init.d/lsyncd chkconfig lsyncd on /etc/init.d/lsyncd start
Copyright(C) systemexpress.co.jp All Rights Reserved. Author Takayuki Yukawa