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