Init script - HeisSpiter/nsca_handler GitHub Wiki
Possible init script (to place in /etc/init.d) to use nsca_handler as service. It provides: start, stop, restart, status.
#!/bin/sh
### BEGIN INIT INFO
# Provides: nsca_handler
# Required-Start: $syslog $local_fs $time
# Required-Stop: $syslog $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nsca_handler
# Description: Handler of NSCA data
### END INIT INFO
. /lib/lsb/init-functions
[ -f /etc/default/rcS ] && . /etc/default/rcS
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
PROGRAM=/usr/local/bin/nsca_handler
test -x $PROGRAM || exit 0
case "$1" in
start)
COUNT=`pgrep -c nsca_handler`
[ "x$COUNT" != "x0" ] && exit 0
$PROGRAM
exit 0
;;
stop)
killall nsca_handler
exit 0
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
COUNT=`pgrep -c nsca_handler`
if [ "x$COUNT" != "x0" ]; then
echo "Running"
else
echo "Not running"
fi
exit 0
;;
*)
echo "Usage: /etc/init.d/nsca_handler {start|stop|restart|force-reload|status}"
exit 1
esac
exit 0