]> git.pld-linux.org Git - packages/nagios-nrpe.git/blame - nrpe.init
Up to 4.1.0
[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
1527661b
ER
30pidfile=/var/run/nrpe/nrpe.pid
31
1426e6f3 32start() {
6095acef 33 if [ -f /var/lock/subsys/nrpe ]; then
1426e6f3 34 msg_already_running "Nagios NRPE daemon"
587f81e1 35 return
6095acef 36 fi
587f81e1
ER
37
38 msg_starting "Nagios NRPE daemon"
39 daemon /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
40 RETVAL=$?
41 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nrpe
1426e6f3
ER
42}
43
44stop() {
587f81e1 45 if [ ! -f /var/lock/subsys/nrpe ]; then
1426e6f3 46 msg_not_running "Nagios NRPE daemon"
587f81e1 47 return
6095acef 48 fi
587f81e1
ER
49
50 msg_stopping "Nagios NRPE daemon"
1527661b 51 killproc --pidfile $pidfile nrpe
587f81e1 52 rm -f /var/lock/subsys/nrpe
1426e6f3
ER
53}
54
1d16747e
ER
55condrestart() {
56 if [ ! -f /var/lock/subsys/nrpe ]; then
57 msg_not_running "Nagios NRPE daemon"
58 RETVAL=$1
59 return
60 fi
61
62 stop
63 start
64}
65
1426e6f3
ER
66RETVAL=0
67case "$1" in
68 start)
69 start
70 ;;
71 stop)
72 stop
6095acef 73 ;;
1d16747e 74 restart)
1426e6f3
ER
75 stop
76 start
6095acef 77 ;;
1d16747e
ER
78 try-restart)
79 condrestart 0
80 ;;
81 force-reload)
82 condrestart 7
83 ;;
6095acef 84 status)
1527661b 85 status --pidfile $pidfile nrpe
90b87f0c 86 exit $?
6095acef
PZ
87 ;;
88 *)
1d16747e 89 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
90b87f0c 90 exit 3
6095acef
PZ
91esac
92
1426e6f3 93exit $RETVAL
This page took 0.041335 seconds and 4 git commands to generate.