]>
Commit | Line | Data |
---|---|---|
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 | |
13 | # config: /usr/local/nagios/etc/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. | |
21 | if is_yes "${NETWORKING}"; then | |
22 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
23 | msg_network_down "nrpe" | |
24 | exit 1 | |
25 | fi | |
26 | else | |
27 | exit 0 | |
28 | fi | |
29 | ||
30 | case "$1" in | |
31 | start) | |
32 | if [ -f /var/lock/subsys/nrpe ]; then | |
33 | msg_already_running "nrpe" | |
34 | else | |
35 | msg_starting "nrpe" | |
36 | daemon nrpe -c /etc/nagios/nrpe.cfg -d | |
37 | touch /var/lock/subsys/nrpe | |
38 | fi | |
39 | ;; | |
40 | stop) | |
41 | if [ -f /var/lock/subsys/nrpe ]; then | |
42 | msg_stopping "nrpe" | |
43 | killproc nrpe | |
44 | rm -f /var/lock/subsys/nrpe | |
45 | else | |
46 | msg_not_running "nrpe" | |
47 | fi | |
48 | ;; | |
90b87f0c | 49 | restart|force-reload) |
6095acef PZ |
50 | $0 stop |
51 | $0 start | |
52 | ;; | |
53 | status) | |
54 | status nrpe | |
90b87f0c | 55 | exit $? |
6095acef PZ |
56 | ;; |
57 | *) | |
90b87f0c | 58 | echo "Usage: nrpe {start|stop|restart|force-reload|status}" |
59 | exit 3 | |
6095acef PZ |
60 | esac |
61 | ||
62 | exit 0 |