fsniper install
yum -y install pcre pcre-devel
$wget http://projects.l3ib.org/fsniper/files/fsniper-1.3.1.tar.gz
$tar -zxmf fsniper-1.3.1.tar.gz
$cd /fsniper-1.3.1
$./configure
$make
$su
#make install
# which fsniper
/usr/local/bin/fsniper
設定ファイル
$mkdir -p ~/.config/fsniper
$vi ~/.config/fsniper/config
watch {
# watch the /var/www/upload directory for new files
/watch/path {
# matches all file with .pdf extension in /var/www/upload directory.
*.sh {
handler = cp /watch/path/%F /watch/path/cache/
}
}
}
テスト
$cd /watch/path
$touch a.sh
$cd /cache/
$ ls
a.sh
コピーされている
成功
自動起動
#vi /etc/init.d/fsniper
#!/bin/sh
#chkconfig: 345 99 01
#description: Runs fsniper
export HOME=/home/dev
case "$1" in
start) echo -n "Starting Fsniper: "
/usr/local/bin/fsniper --daemon
echo -e "... [ \e[00;32mOK\e[00m ]"
;;
stop)
echo -n "Shutdown Fsniper: "
kill -9 `ps aux | grep "fsniper --daemon" | grep -v grep | awk {'print $2'}`
echo -e "... [ \e[00;32mOK\e[00m ]"
;;
restart)
$0 stop
sleep 1
$0 start
;;
*) echo "Usage: `basename $0` start|stop|restart"
exit 1
esac
exit 0
#cmod 755 /etc/init.d/fsniper
# chkconfig --add fsniper
# chkconfig --list fsniper
fsniper 0:off 1:off 2:off 3:on 4:on 5:on 6:off