]> git.pld-linux.org Git - packages/nagios.git/blobdiff - nagios.init
- recover dependencies.cfg
[packages/nagios.git] / nagios.init
index 3116508a21ed5ff2f34436228399f3d13a3ad1e8..cd55aec7aec42713709bdd65a46d6ee5ba36b3b7 100644 (file)
@@ -27,12 +27,8 @@ fi
 
 # configtest itself
 configtest() {
-       local rc out
-       out=`/usr/sbin/nagios -v /etc/nagios/nagios.cfg 2>&1`; rc=$?
-       if [ $rc -gt 0 ]; then
-               echo >&2 "$out"
-       fi
-       return $rc
+       /usr/sbin/nagios -v /etc/nagios/nagios.cfg 2>&1
+       return $?
 }
 
 # wrapper for configtest:
@@ -41,9 +37,16 @@ checkconfig() {
 
        if [ $details = 1 ]; then
                # run config test and display report (status action)
-               show "Checking %s configuration" "Nagios"; busy; echo
-               configtest
+               show "Checking %s configuration" "Nagios"; busy
+               local out
+               out=`configtest 2>&1`
                RETVAL=$?
+               if [ $RETVAL = 0 ]; then
+                       ok
+               else
+                       fail
+               fi
+               [ "$out" ] && echo >&2 "$out"
        else
                # run config test and abort with nice message if failed
                # (for actions checking status before action).
@@ -88,30 +91,30 @@ stop() {
        rm -f /var/lock/subsys/nagios > /dev/null 2>&1
 }
 
-condrestart() {
+reload() {
        if [ ! -f /var/lock/subsys/nagios ]; then
                msg_not_running "Nagios"
-               RETVAL=$1
+               RETVAL=7
                return
        fi
 
        checkconfig
-       stop
-       start
+       msg_reloading "Nagios"
+
+       killproc nagios -HUP
+       RETVAL=$?
 }
 
-reload() {
+condrestart() {
        if [ ! -f /var/lock/subsys/nagios ]; then
                msg_not_running "Nagios"
-               RETVAL=7
+               RETVAL=$1
                return
        fi
 
        checkconfig
-       msg_reloading "Nagios"
-
-       killproc nagios -HUP
-       RETVAL=$?
+       stop
+       start
 }
 
 RETVAL=0
@@ -134,7 +137,7 @@ case "$1" in
   reload|force-reload)
        reload
        ;;
-  checkconfig|check|configtest)
+  checkconfig|configtest)
        checkconfig 1
        ;;
   status)
This page took 0.113172 seconds and 4 git commands to generate.