tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <bpor...@f2network.com.au>
Subject RE: Bringing up tomcat, reliably.
Date Sun, 11 Nov 2001 23:03:47 GMT
I use RedHat 7.1 and have never seen this problem as long as the tomcat
instance is gone (ie ps -ef doesn't report java ... bootstrap.jar running).

Here is the stop script I use:
#!/bin/sh

CATALINA_BASE=`dirname $0`
export CATALINA_BASE

JAVA_HOME=/usr/java/jdk1.3.1
export JAVA_HOME

CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME

ps --width=250 -ef | grep -v grep | egrep "tomcat.+bootstrap\.jar" | if read
t1 t2 t3
then
    echo Shutting down Tomcat...
    $CATALINA_HOME/bin/catalina.sh stop "$@"
fi

ps --width=250 -ef | grep -v grep | egrep "tomcat.+bootstrap\.jar" | if read
t1 t2 t3
then
    # Give it 10 seconds, that's normal
    echo Waiting 5 seconds...
    sleep 5
fi

ps --width=250 -ef | grep -v grep | egrep "tomcat.+bootstrap\.jar" | if read
t1 t2 t3
then
    # Give it another 25 seconds, then we'll nuke it
    echo Still running, giving it another 25 seconds...
    sleep 25
fi

ps --width=250 -ef | grep -v grep | egrep "tomcat.+bootstrap\.jar" | if read
t1 t2 t3
then
    # Alright that's it - thread dump then try the friendly -15
    # NOTE: this assumes the first in the list the "root" instance - there
will be several
    # So far as I've seen this is always correct
    echo Being stubborn, thread dumping and asking PID $t2 to leave with
kill -15
    kill -3 $t2
    kill -15 $t2
    sleep 2
fi

ps --width=250 -ef | grep -v grep | egrep "tomcat.+bootstrap\.jar" | if read
t1 t2 t3
then
    # Still there!
    echo Murdering PID $t2 with kill -9
    kill -9 $t2
    sleep 1
fi

ps --width=250 -ef | grep -v grep | egrep "tomcat.+bootstrap\.jar" | if read
t1 t2 t3
then
    echo It's still there... I'm out of ideas.
fi

Cheers,
Brett

-----Original Message-----
From: Tom Drake [mailto:rtd@pobox.com]
Sent: Monday, 12 November 2001 10:02 AM
To: Tomcat Users List
Subject: Re: Bringing up tomcat, reliably.


Bob:

I can't really comment on Linux, but most Unixes will encumber bound
ports for a while (read a minute or two) under certain circumstances.
This could be triggered if Tomcat had open client connections at
the time of shutdown.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message