SOURCES: nagios.init - use functions

glen glen at pld-linux.org
Mon Oct 30 11:50:19 CET 2006


Author: glen                         Date: Mon Oct 30 10:50:19 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   nagios.init (1.17 -> 1.18) 

---- Diffs:

================================================================
Index: SOURCES/nagios.init
diff -u SOURCES/nagios.init:1.17 SOURCES/nagios.init:1.18
--- SOURCES/nagios.init:1.17	Mon Oct 30 11:49:17 2006
+++ SOURCES/nagios.init	Mon Oct 30 11:50:14 2006
@@ -35,10 +35,7 @@
 	return $rc
 }
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/nagios ]; then
 		msg_starting Nagios
@@ -54,8 +51,9 @@
 	else
 		msg_already_running Nagios
 	fi
-	;;
-stop)
+}
+
+stop() {
 	# Stop daemons.
 	if [ -f /var/lock/subsys/nagios ]; then
 		msg_stopping Nagios
@@ -64,10 +62,16 @@
 	else
 		msg_not_running Nagios
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+start)
+	start
 	;;
-status)
-	status nagios
-	exit $?
+stop)
+	stop
 	;;
 checkconfig|check|configtest)
 	/usr/sbin/nagios -v /etc/nagios/nagios.cfg
@@ -88,8 +92,11 @@
 restart)
 	msg_reloading Nagios
 	checkconfig || exit && started
-	$0 stop
-	$0 start
+	stop
+	start
+	;;
+status)
+	status nagios
 	exit $?
 	;;
 *)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/nagios.init?r1=1.17&r2=1.18&f=u



More information about the pld-cvs-commit mailing list