tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Golden Planet Support" <>
Subject Modified "stop"-script for Linux
Date Mon, 19 Aug 2002 07:57:31 GMT
Hello All

I have noticed that the /etc/init.d/tomcat4 script still contains 
what is described as an "Ugly hack" - a short two second pause when 
restarting the service instead of something that confirms that all 
threads have been shut down.

A while ago I modified my own script to conatain the following lines -
 perhaps they could be of some use for others, I don't know. I am by 
no means an experienced coder so please bear with me if this is not 
the most elegant solution - it just works for me... ;-)

stop() {
    echo -n "Stopping $TOMCAT_PROG: "
    if [ -x /etc/rc.d/init.d/functions ]; then
        daemon --user $TOMCAT_USER $TOMCAT_SCRIPT stop
        su - $TOMCAT_USER -c "$TOMCAT_SCRIPT stop"

    echo 'Waiting for java threads to finish...'
    until [ $threads = '0' ]
	    	ps -aux | grep $TOMCAT_USER -c > /tmp/threads
	    	read threads < /tmp/threads
    rm -f /tmp/threads
    echo 'Java threads cleaned up - shutdown complete.'

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

The above works on a x86 RedHat 7.1 - I don't know if things may work 
differently on other systems.

Med venlig hilsen / Best regards

Anders C. Madsen

Golden Planet          Tel.: +45 7020 9594
Dalbygade 40           Fax.: +45 7020 9592
DK-6000  Kolding

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message