From: Marc Cromme Date: Thu, 14 Aug 2003 08:17:05 +0000 (+0000) Subject: init script for package tkl-web-harvester added X-Git-Tag: tclrobot.0.2.0~8 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=2cd168d6052442c9d4fa14fbf8a20ebcc9327bc5;p=tclrobot.git init script for package tkl-web-harvester added --- diff --git a/debian/tkl-web-harvester.init b/debian/tkl-web-harvester.init new file mode 100755 index 0000000..d25699d --- /dev/null +++ b/debian/tkl-web-harvester.init @@ -0,0 +1,86 @@ +#! /bin/sh +# $Id: tkl-web-harvester.init,v 1.1 2003/08/14 08:17:05 marc Exp $ +# Start and stop tkl's tclrobot web harvester +# change runlevels using update-rc.d + +# What robot to start +BINDIR=/home/heikki/index/tclharv/tklite-utils/tcl/robot +ROBOT=$BINDIR/robot.tcl +# Where to find tkl default values +DEFAULTS="./tkl.default" ## "/etc/default/tkl" when in production!!! + +DISPLAYNAME="web harvester" +ROBOTNAME="tcl-webrobot" # file name base for logs etc + +test -x $ROBOT || exit 0 +test -f $DEFAULTS || exit 0 + +source $DEFAULTS + +# Now sourced from /etc/default/tkl +#TKL_USER="www-data" +#TKL_GROUP=www-data +#TKL_CONF_FILE=/etc/tkl.conf +#TKL_SPOOL_DIR=/var/spool/tkl +#TKL_LOG_DIR=/var/log/tkl +#TKL_PID_DIR=/var/pid/tkl +#TKL_TMP_DIR=/var/tmp/tkl +#TKL_PORTAL_DIRS + +# Specific paths +LOGFILE=$TKL_LOG_DIR/$ROBOTNAME.log +PIDFILE=$TKL_PID_DIR/$ROBOTNAME.PID +ROBOTOPTIONS=" \ + -o $LOGFILE \ + -p $PIDFILE \ + -T $TKL_TMP_DIR \ + -L $BINDIR \ + -D $TKL_SPOOL_DIR" + +# perform usual init.d daemon services +case "$1" in + start) + echo "Starting $DISPLAYNAME: " + if [ "$TKL_DEBUG" ] + then + echo Starting $ROBOT + echo with args $ROBOTOPTIONS + fi + cd $BINDIR # tcl needs to load a .so or two, from the same place... + start-stop-daemon --start \ + --pidfile $PIDFILE \ + --chuid $TKL_USER:$TKL_GROUP \ + --background \ + --exec $ROBOT -- $ROBOTOPTIONS + # disabling --quiet and --background makes debugging *much* easier! + # but they are nice to have in production + sleep 1 + if [ -f $PIDFILE ] + then + echo OK `cat $PIDFILE` + else + echo "Error - did not start" + fi + ;; + + stop) + echo "Stopping $DISPLAYNAME: " + start-stop-daemon --stop \ + --pidfile $PIDFILE \ + # --quiet + rm -f $PIDFILE + # -f more to keep silent if it isn't there! + ;; + + restart|reload|force-reload) + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "Usage: /etc/init.d/tkl {start|stop|restart}" + exit 1 +esac + +exit 0