LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   unable to stop start tomcat (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-stop-start-tomcat-945247/)

fachhoch@gmail.com 05-16-2012 04:08 AM

unable to stop start tomcat
 
I placed tomcat file in /etc/init.d

here is the content of file
Code:


#!/bin/sh

# A slightly better Apache Tomcat start/stop script

#

# chkconfig: 345 80 20

# description: Apache Tomcat



# Source the init.d function library

. /etc/init.d/functions



RETVAL="0"



case $1 in

start)

        echo "Starting Tomcat:"

        /bin/su -s /bin/sh - tomcat -c /opt/apache-tomcat-6.0.35/bin/startup.sh

        RETVAL=$?

        [ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat

        ;;

stop)

        echo "Stopping Tomcat:"

        /bin/su -s /bin/sh - tomcat -c /opt/apache-tomcat-6.0.35/bin/shutdown.sh

        RETVAL=$?

        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat

        ;;

restart)

        $0 stop

        $0 start

        ;;

condrestart)

        [ -e /var/lock/subsys/tomcat ] && $0 restart

        ;;

status)

        status tomcat

        ;;

*)

        echo "Usage: $0 {start|stop|restart|status}"

        RETVAL="1"

esac

exit $RETVAL

also to resolve issues with pid another file in /var/run/tomcat.pid

here contents
Code:

start)

        echo "Starting Tomcat:"

        # Fix pid file permissions

        touch /var/run/tomcat.pid 2>&1 || RETVAL="4"

        if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then

              chown tomcat:tomcat /var/run/tomcat.pid

        fi

        /bin/su -s /bin/sh - tomcat -c /opt/apache-tomcat-6.0.35/bin/startup.sh


stop)

        echo "Stopping Tomcat:"

        /bin/su -s /bin/sh - tomcat -c /opt/apache-tomcat-6.0.35/bin/shutdown.sh

        RETVAL=$?

      [ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat /var/run/tomcat.pid


I run the command

service tomcat stop

Code:

[root@ip-10-140-5-209 /]# service tomcat stop
Stopping Tomcat:
Using CATALINA_BASE:  /opt/apache-tomcat-6.0.35
Using CATALINA_HOME:  /opt/apache-tomcat-6.0.35
Using CATALINA_TMPDIR: /opt/apache-tomcat-6.0.35/temp
Using JRE_HOME:        /opt/jre1.6.0_32
Using CLASSPATH:      /opt/apache-tomcat-6.0.35/bin/bootstrap.jar
Using CATALINA_PID:    /var/run/tomcat.pid
Tomcat did not stop in time. PID file was not removed.

Please help me resolve this.


All times are GMT -5. The time now is 02:20 AM.