wok-6.x view nagios-nrpe/stuff/nrpe @ rev 16681
Create some /var/run/<dir> in /etc/init.d/<daemon> scritps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun May 18 20:24:07 2014 +0000 (2014-05-18) |
parents | f898e6080f92 |
children | 7f188676b59c |
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="NRPE daemon"
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 echo "$NAME already running."
26 exit 1
27 fi
28 echo -n "Starting $DESC: $NAME... "
29 $DAEMON $OPTIONS
30 status
31 ;;
32 stop)
33 if ! active_pidfile $PIDFILE nrpe ; then
34 echo "$NAME is not running."
35 exit 1
36 fi
37 echo -n "Stopping $DESC: $NAME... "
38 kill `cat $PIDFILE`
39 status
40 ;;
41 restart|reload)
42 if ! active_pidfile $PIDFILE nrpe ; then
43 echo "$NAME is not running."
44 exit 1
45 fi
46 echo -n "Restarting $DESC: $NAME... "
47 kill `cat $PIDFILE`
48 sleep 2
49 $DAEMON $OPTIONS
50 status
51 ;;
52 *)
53 echo ""
54 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
55 echo ""
56 exit 1
57 ;;
58 esac
60 exit 0