wok-current annotate nagios-nrpe/stuff/nrpe @ rev 18465
libQtDBus: add /usr/bin/qdbus
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Fri Oct 02 13:31:38 2015 +0200 (2015-10-02) |
parents | f898e6080f92 |
children | 7f188676b59c |
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 |
pascal@16681 | 18 if [ ! -d /var/run/nagios ]; then |
pascal@16681 | 19 mkdir -p /var/run/nagios |
pascal@16681 | 20 chown nagios.nagios /var/run/nagios |
pascal@16681 | 21 fi |
erjo@8331 | 22 case "$1" in |
erjo@8331 | 23 start) |
erjo@8331 | 24 if active_pidfile $PIDFILE nrpe ; then |
erjo@8331 | 25 echo "$NAME already running." |
erjo@8331 | 26 exit 1 |
erjo@8331 | 27 fi |
erjo@8331 | 28 echo -n "Starting $DESC: $NAME... " |
erjo@8331 | 29 $DAEMON $OPTIONS |
erjo@8331 | 30 status |
erjo@8331 | 31 ;; |
erjo@8331 | 32 stop) |
erjo@8331 | 33 if ! active_pidfile $PIDFILE nrpe ; then |
erjo@8331 | 34 echo "$NAME is not running." |
erjo@8331 | 35 exit 1 |
erjo@8331 | 36 fi |
erjo@8331 | 37 echo -n "Stopping $DESC: $NAME... " |
erjo@8331 | 38 kill `cat $PIDFILE` |
erjo@8331 | 39 status |
erjo@8331 | 40 ;; |
erjo@8331 | 41 restart|reload) |
erjo@8331 | 42 if ! active_pidfile $PIDFILE nrpe ; then |
erjo@8331 | 43 echo "$NAME is not running." |
erjo@8331 | 44 exit 1 |
erjo@8331 | 45 fi |
erjo@8331 | 46 echo -n "Restarting $DESC: $NAME... " |
erjo@8331 | 47 kill `cat $PIDFILE` |
erjo@8331 | 48 sleep 2 |
erjo@8331 | 49 $DAEMON $OPTIONS |
erjo@8331 | 50 status |
erjo@8331 | 51 ;; |
erjo@8331 | 52 *) |
erjo@8331 | 53 echo "" |
erjo@8331 | 54 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]" |
erjo@8331 | 55 echo "" |
erjo@8331 | 56 exit 1 |
erjo@8331 | 57 ;; |
erjo@8331 | 58 esac |
erjo@8331 | 59 |
erjo@8331 | 60 exit 0 |