wok-6.x view nagios-nrpe/stuff/nrpe @ rev 23548
Up bcrelay (1.4.0)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Apr 06 17:04:09 2020 +0000 (2020-04-06) |
parents | 0d8a1a3edc72 |
children |
line source
1 #!/bin/sh
2 # /etc/init.d/nrpe : Start, stop and restart NRPE Server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start SSH server at boot time, just put nagios in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=NRPE
12 DESC="$(_ '%s daemon' NRPE)"
13 DAEMON=/usr/bin/nrpe
14 CONFIG_FILE="/etc/nagios/nrpe.cfg"
15 OPTIONS="-n -c $CONFIG_FILE -d"
16 PIDFILE=/var/run/nagios/nrpe.pid
18 if [ ! -d /var/run/nagios ]; then
19 mkdir -p /var/run/nagios
20 chown nagios.nagios /var/run/nagios
21 fi
22 case "$1" in
23 start)
24 if active_pidfile $PIDFILE nrpe ; then
25 _ '%s is already running.' $NAME
26 exit 1
27 fi
28 action 'Starting %s: %s...' "$DESC" $NAME
29 $DAEMON $OPTIONS
30 status
31 ;;
32 stop)
33 if ! active_pidfile $PIDFILE nrpe ; then
34 _ '%s is not running.' $NAME
35 exit 1
36 fi
37 action 'Stopping %s: %s...' "$DESC" $NAME
38 kill $(cat $PIDFILE)
39 status
40 ;;
41 restart|reload)
42 if ! active_pidfile $PIDFILE nrpe ; then
43 _ '%s is not running.' $NAME
44 exit 1
45 fi
46 action 'Restarting %s: %s...' "$DESC" $NAME
47 kill $(cat $PIDFILE)
48 sleep 2
49 $DAEMON $OPTIONS
50 status
51 ;;
52 *)
53 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]"
54 newline
55 exit 1
56 ;;
57 esac
59 exit 0