wok-next annotate nagios-nrpe/stuff/nrpe @ rev 19159

/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 26 20:16:45 2016 +0300 (2016-05-26)
parents 0d8a1a3edc72
children
rev   line source
erjo@8331 1 #!/bin/sh
al@19159 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
al@19159 12 DESC="$(_ '%s daemon' NRPE)"
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
al@19159 19 mkdir -p /var/run/nagios
al@19159 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
al@19159 25 _ '%s is already running.' $NAME
erjo@8331 26 exit 1
erjo@8331 27 fi
al@19159 28 action 'Starting %s: %s...' "$DESC" $NAME
al@19159 29 $DAEMON $OPTIONS
erjo@8331 30 status
erjo@8331 31 ;;
erjo@8331 32 stop)
erjo@8331 33 if ! active_pidfile $PIDFILE nrpe ; then
al@19159 34 _ '%s is not running.' $NAME
erjo@8331 35 exit 1
erjo@8331 36 fi
al@19159 37 action 'Stopping %s: %s...' "$DESC" $NAME
al@19159 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
al@19159 43 _ '%s is not running.' $NAME
erjo@8331 44 exit 1
erjo@8331 45 fi
al@19159 46 action 'Restarting %s: %s...' "$DESC" $NAME
al@19159 47 kill $(cat $PIDFILE)
erjo@8331 48 sleep 2
erjo@8331 49 $DAEMON $OPTIONS
erjo@8331 50 status
erjo@8331 51 ;;
erjo@8331 52 *)
al@19159 53 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]"
al@19159 54 newline
erjo@8331 55 exit 1
erjo@8331 56 ;;
erjo@8331 57 esac
erjo@8331 58
erjo@8331 59 exit 0