SOURCES: monit.init - use functions

glen glen at pld-linux.org
Mon Oct 2 00:04:13 CEST 2006


Author: glen                         Date: Sun Oct  1 22:04:13 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   monit.init (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: SOURCES/monit.init
diff -u SOURCES/monit.init:1.10 SOURCES/monit.init:1.11
--- SOURCES/monit.init:1.10	Tue May 30 13:40:40 2006
+++ SOURCES/monit.init	Mon Oct  2 00:04:08 2006
@@ -12,10 +12,7 @@
 # Get service config
 [ -f /etc/sysconfig/monit ] && . /etc/sysconfig/monit
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/monit ]; then
 		msg_starting monit
@@ -25,8 +22,9 @@
 	else
 		msg_already_running monit
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	# Stop daemons.
 	if [ -f /var/lock/subsys/monit ]; then
 		msg_stopping monit
@@ -35,16 +33,20 @@
 	else
 		msg_not_running monit
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
 	;;
-  status)
-	status monit
-	monit -c /etc/monitrc status
-	exit $?
+  stop)
+  	stop
 	;;
   restart)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
 	;;
   reload|force-reload)
 	if [ -f /var/lock/subsys/monit ]; then
@@ -55,6 +57,11 @@
 		msg_not_running monit
 		exit 7
 	fi
+	;;
+  status)
+	status monit
+	monit -c /etc/monitrc status
+	exit $?
 	;;
   *)
 	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/monit.init?r1=1.10&r2=1.11&f=u



More information about the pld-cvs-commit mailing list