]>
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 | # | |
6 | # nrpe This shell script takes care of starting and stopping | |
7 | # nrpe. | |
8 | # | |
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 | |
14 | ||
15 | ||
16 | . /etc/rc.d/init.d/functions | |
17 | ||
18 | # Source networking configuration. | |
19 | . /etc/sysconfig/network | |
20 | ||
21 | # Check that networking is up. | |
22 | if is_yes "${NETWORKING}"; then | |
23 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
24 | msg_network_down "nrpe" | |
25 | exit 1 | |
26 | fi | |
27 | else | |
28 | exit 0 | |
29 | fi | |
30 | ||
31 | case "$1" in | |
32 | start) | |
33 | if [ -f /var/lock/subsys/nrpe ]; then | |
34 | msg_already_running "nrpe" | |
35 | else | |
36 | msg_starting "nrpe" | |
37 | daemon nrpe -c /etc/nagios/nrpe.cfg -d | |
38 | touch /var/lock/subsys/nrpe | |
39 | fi | |
40 | ;; | |
41 | stop) | |
42 | if [ -f /var/lock/subsys/nrpe ]; then | |
43 | msg_stopping "nrpe" | |
44 | killproc nrpe | |
45 | rm -f /var/lock/subsys/nrpe | |
46 | else | |
47 | msg_not_running "nrpe" | |
48 | fi | |
49 | ;; | |
50 | restart) | |
51 | $0 stop | |
52 | $0 start | |
53 | ;; | |
54 | status) | |
55 | status nrpe | |
56 | ;; | |
57 | *) | |
58 | echo "Usage: nrpe {start|stop|restart|status}" | |
59 | exit 1 | |
60 | esac | |
61 | ||
62 | exit 0 |