summaryrefslogtreecommitdiff
path: root/network/nsca/rc.nsca
diff options
context:
space:
mode:
authorBas Couwenberg <sebastic@xs4all.nl>2010-12-28 14:28:48 -0600
committerRobby Workman <rworkman@slackbuilds.org>2010-12-29 01:08:49 -0600
commit317811518be63939f7637b715ee95adcb28f7e2c (patch)
tree2b5c78b5352e7ce663799e666348655172a73f2b /network/nsca/rc.nsca
parent2cca181910818e6af4fa9c1e71cb9ae1718af3f7 (diff)
downloadslackbuilds-317811518be63939f7637b715ee95adcb28f7e2c.tar.gz
network/nsca: Added (Nagios Service Check Acceptor)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'network/nsca/rc.nsca')
-rw-r--r--network/nsca/rc.nsca79
1 files changed, 79 insertions, 0 deletions
diff --git a/network/nsca/rc.nsca b/network/nsca/rc.nsca
new file mode 100644
index 0000000000..25812bcb59
--- /dev/null
+++ b/network/nsca/rc.nsca
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# nsca daemon control script.
+#
+# This is an init script for the nsca daemon.
+# To use nsca, you must first set up the config file(s).
+#
+# Written for Slackware Linux by Cherife li <cherife@dotimes.com>
+# Modified for SBo by Zordrak <slackbuilds@tpa.me.uk>
+
+BIN=/usr/bin/nsca
+CFGFILE=/etc/nagios/nsca.cfg
+PIDFILE=/var/run/nsca.pid
+LOCKFILE=/var/lock/nsca
+
+printstatus()
+{
+ if [ -e $PIDFILE ]; then
+ echo "nsca (pid $PID) is running..."
+ else
+ echo "nsca is not running"
+ fi
+}
+
+killproc()
+{
+ kill $2 $PID
+}
+
+getpid()
+{
+ if test ! -f $PIDFILE; then
+ echo "Pid file $PIDFILE not found."
+ exit 1
+ else
+ PID=`head -n 1 $PIDFILE`
+ fi
+}
+
+# Check whether nsca bin file exists.
+if [ ! -f $BIN ]; then
+ echo "Executable file $BIN not found. Exiting."
+ exit 1
+fi
+
+# Check whether nsca config exists.
+if [ ! -f $CFGFILE ]; then
+ echo "Configuration file $CFGFILE not found. Exiting."
+ exit 1
+fi
+
+# Controls
+case "$1" in
+ start)
+ echo -n "Starting nsca:"
+ $BIN -c $CFGFILE -d
+ touch $LOCKFILE
+ echo " done."
+ ;;
+ stop)
+ echo -n "Stopping nsca:"
+ getpid
+ killproc nsca
+ rm -f $LOCKFILE
+ echo " done."
+ ;;
+ status)
+ getpid
+ printstatus nsca
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: nsca {start|stop|restart|status}"
+ exit 1
+ ;;
+esac