Source

repomonitor / rc.repomonitor

Full commit
#!/bin/sh -e
#
# rc.repomonitor
# Starts a daemon that listen for filesystem events in a repository root
# rbistolfi - 2012
#


REPO_ROOT=/tmp
TAC_FILE=/usr/lib/repomonitor/service.tac
LOG_FILE=/var/log/repomonitor.log
PID_FILE=/var/run/repomonitor.pid
TWISTD=`which twistd`


case $1 in
	start)
        VL_REPO_ROOT=$REPO_ROOT $TWISTD --logfile $LOG_FILE --pidfile $PID_FILE -y $TAC_FILE
	;;
	stop)
	if [ -e $PID_FILE ]; then
		PID=`cat $PID_FILE`
	else
		echo "VL-RepoMonitor is NOT running."
		exit 1
	fi
        kill -INT $PID
	;;
	restart)
        $0 stop
        $0 start
	;;
	status)
		if [ -e $PID_FILE ]; then
			PID=`cat $PID_FILE`
			echo "VL-RepoMonitor is running (pid $PID)."
			exit 0
		else
			echo "VL-RepoMonitor is NOT running."
			exit 1
		fi	
	;;
	*)
        echo "Usage: $0 {start|stop|restart}"
		exit 1
	;;
esac