wok-next annotate nagios-nrpe/stuff/nrpe @ rev 15322
Up parole (0.5.2)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Sep 27 19:24:26 2013 +0000 (2013-09-27) |
parents | |
children | 0d8a1a3edc72 |
rev | line source |
---|---|
erjo@8331 | 1 #!/bin/sh |
erjo@8331 | 2 # /etc/init.d/nrpe : Start, stop and restart NRPE Server on SliTaz, at |
erjo@8331 | 3 # boot time or with the command line. |
erjo@8331 | 4 # |
erjo@8331 | 5 # To start SSH server at boot time, just put nagios in the $RUN_DAEMONS |
erjo@8331 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf |
erjo@8331 | 7 # |
erjo@8331 | 8 . /etc/init.d/rc.functions |
erjo@8331 | 9 . /etc/daemons.conf |
erjo@8331 | 10 |
erjo@8331 | 11 NAME=NRPE |
erjo@8331 | 12 DESC="NRPE daemon" |
erjo@8331 | 13 DAEMON=/usr/bin/nrpe |
erjo@8331 | 14 CONFIG_FILE="/etc/nagios/nrpe.cfg" |
erjo@8331 | 15 OPTIONS="-n -c $CONFIG_FILE -d" |
erjo@8331 | 16 PIDFILE=/var/run/nagios/nrpe.pid |
erjo@8331 | 17 |
erjo@8331 | 18 case "$1" in |
erjo@8331 | 19 start) |
erjo@8331 | 20 if active_pidfile $PIDFILE nrpe ; then |
erjo@8331 | 21 echo "$NAME already running." |
erjo@8331 | 22 exit 1 |
erjo@8331 | 23 fi |
erjo@8331 | 24 echo -n "Starting $DESC: $NAME... " |
erjo@8331 | 25 $DAEMON $OPTIONS |
erjo@8331 | 26 status |
erjo@8331 | 27 ;; |
erjo@8331 | 28 stop) |
erjo@8331 | 29 if ! active_pidfile $PIDFILE nrpe ; then |
erjo@8331 | 30 echo "$NAME is not running." |
erjo@8331 | 31 exit 1 |
erjo@8331 | 32 fi |
erjo@8331 | 33 echo -n "Stopping $DESC: $NAME... " |
erjo@8331 | 34 kill `cat $PIDFILE` |
erjo@8331 | 35 status |
erjo@8331 | 36 ;; |
erjo@8331 | 37 restart|reload) |
erjo@8331 | 38 if ! active_pidfile $PIDFILE nrpe ; then |
erjo@8331 | 39 echo "$NAME is not running." |
erjo@8331 | 40 exit 1 |
erjo@8331 | 41 fi |
erjo@8331 | 42 echo -n "Restarting $DESC: $NAME... " |
erjo@8331 | 43 kill `cat $PIDFILE` |
erjo@8331 | 44 sleep 2 |
erjo@8331 | 45 $DAEMON $OPTIONS |
erjo@8331 | 46 status |
erjo@8331 | 47 ;; |
erjo@8331 | 48 *) |
erjo@8331 | 49 echo "" |
erjo@8331 | 50 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]" |
erjo@8331 | 51 echo "" |
erjo@8331 | 52 exit 1 |
erjo@8331 | 53 ;; |
erjo@8331 | 54 esac |
erjo@8331 | 55 |
erjo@8331 | 56 exit 0 |