From 2203b9fde5ca55d08070d672e7563debeaafba3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 3 Oct 2008 18:54:08 +0000 Subject: [PATCH] - use functions Changed files: apache-tomcat.init -> 1.9 --- apache-tomcat.init | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/apache-tomcat.init b/apache-tomcat.init index cbfba78..ed8eccf 100644 --- a/apache-tomcat.init +++ b/apache-tomcat.init @@ -28,23 +28,25 @@ else 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 @@ case "$1" in 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 @@ case "$1" in esac exit $RETVAL - -# This must be last line ! -# vi:syntax=sh:tw=78:ts=8:sw=4 -- 2.44.0