[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: add config checks for start, reload and restart on rhel init script

git at icinga.org git at icinga.org
Mon Jul 26 10:28:43 CEST 2010


Module: icinga-core
Branch: mfriedrich/core
Commit: ea3f79bd7b9a907ee825f1cef03af0e55bc4a3da
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=ea3f79bd7b9a907ee825f1cef03af0e55bc4a3da

Author: Christoph Maser <cmr at financial.com>
Date:   Sun Jul 25 00:17:45 2010 +0200

add config checks for start, reload and restart on rhel init script

---

 daemon-init-redhat.in |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/daemon-init-redhat.in b/daemon-init-redhat.in
index c6f66d6..836d8aa 100644
--- a/daemon-init-redhat.in
+++ b/daemon-init-redhat.in
@@ -65,9 +65,19 @@ force_reload() {
     restart
 }
 
+check_config() {
+        $nice runuser -s /bin/bash - $user -c "$corelimit >/dev/null 2>&1 ; $exec -v $config > /dev/null 2>&1"
+	RETVAL=$?
+	if [ $RETVAL -ne 0 ] ; then
+		echo "Configuration error: please check the config by runing \"$exec -v $config\""
+		exit 1
+	fi
+}
+
 case "$1" in
     start)
         status $prog && exit 0
+	check_config
         $1
         ;;
     stop)
@@ -75,10 +85,12 @@ case "$1" in
         $1
         ;;
     restart)
+	check_config
         $1
         ;;
     reload)
         status $prog || exit 7
+	check_config
         $1
         ;;
     force-reload)
@@ -92,8 +104,7 @@ case "$1" in
         restart
         ;;
    configtest)
-        $nice runuser -s /bin/bash - $user -c "$corelimit >/dev/null 2>&1 ; $exec -v $config"
-	RETVAL=$?
+	check_config
 	;;
     *)
         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"





More information about the icinga-checkins mailing list