]> granicus.if.org Git - icinga2/commitdiff
Init script: Check whether the PID file exists
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 2 Sep 2014 11:48:48 +0000 (13:48 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 2 Sep 2014 11:48:48 +0000 (13:48 +0200)
fixes #7047

etc/initsystem/icinga2.init.d.cmake

index de5679c7a6353a11fcd6177ae0297f32c43ae140..ad61fb27600d578025be253089c8ef5573f33b1e 100644 (file)
@@ -65,7 +65,7 @@ stop() {
                 if [ "x$1" = "xnofail" ]; then
                        return
                else
-                       exit 1
+                       exit 7
                fi
         fi
 
@@ -94,6 +94,10 @@ stop() {
 reload() {
        printf "Reloading Icinga 2: "
 
+       if [ ! -e $ICINGA2_PID_FILE ]; then
+               exit 7
+       fi
+
        pid=`cat $ICINGA2_PID_FILE`
        if kill -HUP $pid >/dev/null 2>&1; then
                echo "Done"
@@ -131,6 +135,11 @@ checkconfig() {
 status() {
        printf "Icinga 2 status: "
 
+       if [ ! -e $ICINGA2_PID_FILE ]; then
+               echo "Not running"
+               exit 7
+       fi
+
        pid=`cat $ICINGA2_PID_FILE`
        if kill -CHLD $pid >/dev/null 2>&1; then
                echo "Running"