SOURCES: apache-tomcat.init - use functions

glen glen at pld-linux.org
Fri Oct 3 20:54:14 CEST 2008


Author: glen                         Date: Fri Oct  3 18:54:14 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   apache-tomcat.init (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: SOURCES/apache-tomcat.init
diff -u SOURCES/apache-tomcat.init:1.8 SOURCES/apache-tomcat.init:1.9
--- SOURCES/apache-tomcat.init:1.8	Tue Aug 21 00:08:06 2007
+++ SOURCES/apache-tomcat.init	Fri Oct  3 20:54:08 2008
@@ -28,23 +28,25 @@
 	exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/tomcat ]; then
 		msg_starting tomcat
 		busy
 		su - http -s /bin/sh -c /usr/share/tomcat/bin/startup.sh >/dev/null 2>&1
 		[ $? -ne 0 ] && RETVAL=1
-		[ $RETVAL -eq 0 ] && ok || fail
-		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/tomcat
+		if [ $RETVAL -eq 0 ]; then
+		   	ok
+			touch /var/lock/subsys/tomcat
+		else
+			fail
+		fi
 	else
 		msg_already_running tomcat
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/tomcat ]; then
 		# Stop daemons.
 		msg_stopping tomcat
@@ -55,11 +57,20 @@
 	else
 		msg_not_running tomcat
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
 	;;
   status)
 	echo "Not supported (yet?)"
@@ -71,6 +82,3 @@
 esac
 
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh:tw=78:ts=8:sw=4
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/apache-tomcat.init?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list