]> git.pld-linux.org Git - packages/nagios-nrpe.git/blame - nrpe.init
- release 5
[packages/nagios-nrpe.git] / nrpe.init
CommitLineData
6095acef
PZ
1#!/bin/sh
2#
3# Created 2000-01-03 by jaclu@grm.se
4# Rewritten for PLD 2004-06-02 by patrys@pld-linux.org
5#
90b87f0c 6# nrpe This shell script takes care of starting and stopping
7# nrpe.
6095acef 8#
90b87f0c 9# chkconfig: 2345 80 30
10# description: nrpe is a daemon for a remote nagios server, \
11# running nagios plugins on this host.
12# processname: nrpe
1426e6f3 13# config: /etc/nagios/nrpe.cfg
6095acef
PZ
14
15. /etc/rc.d/init.d/functions
16
17# Source networking configuration.
18. /etc/sysconfig/network
19
20# Check that networking is up.
21if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
1426e6f3 23 msg_network_down "Nagios NRPE daemon"
6095acef
PZ
24 exit 1
25 fi
26else
27 exit 0
28fi
29
1426e6f3 30start() {
6095acef 31 if [ -f /var/lock/subsys/nrpe ]; then
1426e6f3 32 msg_already_running "Nagios NRPE daemon"
6095acef 33 else
1426e6f3 34 msg_starting "Nagios NRPE daemon"
6095acef 35 daemon nrpe -c /etc/nagios/nrpe.cfg -d
e10dc1bf 36 RETVAL=$?
37 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nrpe
6095acef 38 fi
1426e6f3
ER
39}
40
41stop() {
6095acef 42 if [ -f /var/lock/subsys/nrpe ]; then
1426e6f3 43 msg_stopping "Nagios NRPE daemon"
6d1e0646 44 killproc --pidfile nrpe/nrpe.pid nrpe
6095acef
PZ
45 rm -f /var/lock/subsys/nrpe
46 else
1426e6f3 47 msg_not_running "Nagios NRPE daemon"
6095acef 48 fi
1426e6f3
ER
49}
50
51RETVAL=0
52case "$1" in
53 start)
54 start
55 ;;
56 stop)
57 stop
6095acef 58 ;;
90b87f0c 59 restart|force-reload)
1426e6f3
ER
60 stop
61 start
6095acef
PZ
62 ;;
63 status)
64 status nrpe
90b87f0c 65 exit $?
6095acef
PZ
66 ;;
67 *)
90b87f0c 68 echo "Usage: nrpe {start|stop|restart|force-reload|status}"
69 exit 3
6095acef
PZ
70esac
71
1426e6f3 72exit $RETVAL
This page took 0.090756 seconds and 4 git commands to generate.