aboutsummaryrefslogtreecommitdiff
path: root/network/nrpe/rc.nrpe
diff options
context:
space:
mode:
authorZordrak <slackbuilds@tpa.me.uk>2010-05-12 23:32:36 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-12 23:32:36 +0200
commit34a7452794f960f3323607605ef839493d9d98a2 (patch)
tree8f84d45fba6e35b556c665929c5f04b9f95b5302 /network/nrpe/rc.nrpe
parentda1bc7177dad31a279db8c401493d2e44c2448e1 (diff)
network/nrpe: Added to 12.2 repository
Diffstat (limited to 'network/nrpe/rc.nrpe')
-rw-r--r--network/nrpe/rc.nrpe79
1 files changed, 79 insertions, 0 deletions
diff --git a/network/nrpe/rc.nrpe b/network/nrpe/rc.nrpe
new file mode 100644
index 0000000000000..4cfa94bdad587
--- /dev/null
+++ b/network/nrpe/rc.nrpe
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# nrpe daemon control script.
+#
+# This is an init script for the nrpe daemon.
+# To use nrpe, 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/nrpe
+CFGFILE=/etc/nagios/nrpe.cfg
+PIDFILE=/var/run/nrpe.pid
+LOCKFILE=/var/lock/nrpe
+
+printstatus()
+{
+ if [ -e $PIDFILE ]; then
+ echo "nrpe (pid $PID) is running..."
+ else
+ echo "nrpe 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 nrpe bin file exists.
+if [ ! -f $BIN ]; then
+ echo "Executable file $BIN not found. Exiting."
+ exit 1
+fi
+
+# Check whether nrpe config exists.
+if [ ! -f $CFGFILE ]; then
+ echo "Configuration file $CFGFILE not found. Exiting."
+ exit 1
+fi
+
+# Controls
+case "$1" in
+ start)
+ echo -n "Starting nrpe:"
+ $BIN -c $CFGFILE -d
+ touch $LOCKFILE
+ echo " done."
+ ;;
+ stop)
+ echo -n "Stopping nrpe:"
+ getpid
+ killproc nrpe
+ rm -f $LOCKFILE
+ echo " done."
+ ;;
+ status)
+ getpid
+ printstatus nrpe
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: nrpe {start|stop|restart|status}"
+ exit 1
+ ;;
+esac