]> git.pld-linux.org Git - packages/nagios-nrpe.git/blobdiff - nrpe.init
up to 3.0.1 (2016-09-08)
[packages/nagios-nrpe.git] / nrpe.init
old mode 100644 (file)
new mode 100755 (executable)
index 8e21794..4cba6ef
--- a/nrpe.init
+++ b/nrpe.init
@@ -27,6 +27,8 @@ else
        exit 0
 fi
 
+pidfile=/var/run/nrpe/nrpe.pid
+
 start() {
        if [ -f /var/lock/subsys/nrpe ]; then
                msg_already_running "Nagios NRPE daemon"
@@ -46,10 +48,21 @@ stop() {
        fi
 
        msg_stopping "Nagios NRPE daemon"
-       killproc --pidfile nrpe/nrpe.pid nrpe
+       killproc --pidfile $pidfile nrpe
        rm -f /var/lock/subsys/nrpe
 }
 
+condrestart() {
+       if [ ! -f /var/lock/subsys/nrpe ]; then
+               msg_not_running "Nagios NRPE daemon"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
 RETVAL=0
 case "$1" in
   start)
@@ -58,16 +71,22 @@ case "$1" in
   stop)
        stop
        ;;
-  restart|force-reload)
+  restart)
        stop
        start
        ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
   status)
-       status nrpe
+       status --pidfile $pidfile nrpe
        exit $?
        ;;
   *)
-       echo "Usage: nrpe {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
This page took 0.075909 seconds and 4 git commands to generate.