repomonitor / rc.repomonitor

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


REPO_ROOT=/tmp
TAC_FILE=/usr/lib/repowatcher/service.tac
LOG_FILE=/var/log/repowatcher.log
PID_FILE=/var/run/repowatcher.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-RepoWatcher 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-RepoWatcher is running (pid $PID)."
			exit 0
		else
			echo "VL-RepoWatcher is NOT running."
			exit 1
		fi	
	;;
	*)
        echo "Usage: $0 {start|stop|restart}"
		exit 1
	;;
esac
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.