You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Michael Wechner <mi...@wyona.org> on 2003/08/27 09:28:35 UTC

tomcatctrl

btw, for those who want to startup Tomcat resp. Lenya during booting, 
please find a "tomcatctrl" at

src/webapp/lenya/bin/tomcatctrl

which could be added to /etc/init.d


Since some Tomcat versions have problems with shutting down all Java 
threads, maybe someone would
like to enhance the script such that it looks up the processes and kills 
them ;-)

Thanks

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: tomcatctrl

Posted by Michael Wechner <mi...@wyona.org>.
Jann Forrer wrote:

>On Wed, 27 Aug 2003, Michael Wechner wrote:
>
>  
>
>>btw, for those who want to startup Tomcat resp. Lenya during booting,
>>please find a "tomcatctrl" at
>>
>>src/webapp/lenya/bin/tomcatctrl
>>
>>which could be added to /etc/init.d
>>
>>
>>Since some Tomcat versions have problems with shutting down all Java
>>threads, maybe someone would
>>like to enhance the script such that it looks up the processes and kills
>>them ;-)
>>
>>    
>>
>
>Recently i wrote a simple script to do that. I included it into the
>lenya tomcatctrl (see the patch in the attachment). The script works on my
>installation: SuSE linux 8.2, java version "1.4.1_02" and tomcat 4.1.27.
>

Thanks very much. I will try it out and commit it accordingly.

Michael

>
>Jann
>
>---------------------------------------------------------------
>Jann Forrer
>Informatikdienste
>Universität Zürich
>Winterthurerstr. 190
>CH-8057 Zuerich
>
>oooO   mail:  jann.forrer@id.unizh.ch
>(  )   phone: +41 1 63 56772
> \ (   fax:   +41 1 63 54505
>  \_)  http://www.id.unizh.ch
>
>------------------------------------------------------------------------
>
>*** tomcatctrl.old	2003-08-15 16:01:45.000000000 +0200
>--- tomcatctrl	2003-08-27 15:29:05.000000000 +0200
>***************
>*** 42,47 ****
>--- 42,60 ----
>  	    echo "Stopping $daemon/shutdown.sh"
>  	    su - $USER -c "export JAVA_HOME=$JAVA_HOME; sh $daemon/shutdown.sh"
>  	done;
>+ 
>+         # is tomcat still running on the system
>+         sleep 10
>+         Nproc=`ps -ef | grep tomcat | grep ^$USER | wc -l`
>+ 
>+         if [ "$Nproc" -gt "5" ]; then
>+            # Get the parent process
>+            PIDstring=$(ps -ef | grep tomcat | grep ^$USER | grep "     1") 
>+            PID=`echo $PIDstring | awk -F " "  '{ print $2 }'`
>+ 
>+            echo "killing the tomcat parent process"
>+            su - $USER -c "kill -TERM $PID"
>+         fi
>  	;;
>    restart|force-reload)
>          # FIXME: Tomcat does not shutdown properly
>***************
>*** 50,56 ****
>  	#	option to the "reload" entry above. If not, "force-reload" is
>  	#	just the same as "restart".
>  	#
>! 	echo "FIXME"
>  	#echo "Restarting $DESC: $NAME"
>  	#for daemon in $DAEMONS; do 
>  	#    echo "Stopping $daemon/shutdown.sh"
>--- 63,74 ----
>  	#	option to the "reload" entry above. If not, "force-reload" is
>  	#	just the same as "restart".
>  	#
>! 
>!         echo "Restarting service Tomcat"
>!         $0 stop
>! 	sleep 10
>!         $0 start
>! 
>  	#echo "Restarting $DESC: $NAME"
>  	#for daemon in $DAEMONS; do 
>  	#    echo "Stopping $daemon/shutdown.sh"
>***************
>*** 66,72 ****
>  	;;
>    *)
>  	#echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
>! 	echo "Usage: $NAME {start|stop}" >&2
>  	exit 1
>  	;;
>  esac
>--- 84,90 ----
>  	;;
>    *)
>  	#echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
>! 	echo "Usage: $NAME {start|stop|restart}" >&2
>  	exit 1
>  	;;
>  esac
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: lenya-user-help@cocoon.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: tomcatctrl

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Wed, 27 Aug 2003, Michael Wechner wrote:

> btw, for those who want to startup Tomcat resp. Lenya during booting,
> please find a "tomcatctrl" at
>
> src/webapp/lenya/bin/tomcatctrl
>
> which could be added to /etc/init.d
>
>
> Since some Tomcat versions have problems with shutting down all Java
> threads, maybe someone would
> like to enhance the script such that it looks up the processes and kills
> them ;-)
>

Recently i wrote a simple script to do that. I included it into the
lenya tomcatctrl (see the patch in the attachment). The script works on my
installation: SuSE linux 8.2, java version "1.4.1_02" and tomcat 4.1.27.

Jann

---------------------------------------------------------------
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zuerich

oooO   mail:  jann.forrer@id.unizh.ch
(  )   phone: +41 1 63 56772
 \ (   fax:   +41 1 63 54505
  \_)  http://www.id.unizh.ch

Re: tomcatctrl

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Wed, 27 Aug 2003, Michael Wechner wrote:

> btw, for those who want to startup Tomcat resp. Lenya during booting,
> please find a "tomcatctrl" at
>
> src/webapp/lenya/bin/tomcatctrl
>
> which could be added to /etc/init.d
>
>
> Since some Tomcat versions have problems with shutting down all Java
> threads, maybe someone would
> like to enhance the script such that it looks up the processes and kills
> them ;-)
>

Recently i wrote a simple script to do that. I included it into the
lenya tomcatctrl (see the patch in the attachment). The script works on my
installation: SuSE linux 8.2, java version "1.4.1_02" and tomcat 4.1.27.

Jann

---------------------------------------------------------------
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zuerich

oooO   mail:  jann.forrer@id.unizh.ch
(  )   phone: +41 1 63 56772
 \ (   fax:   +41 1 63 54505
  \_)  http://www.id.unizh.ch