[WBEL-users] Tomcat and WBEL
Karl-König Königsson
karl-konig.q.konigsson@posten.se
Mon, 17 May 2004 09:14:51 +0200
This is a multi-part message in MIME format.
--------------080105050607030108000603
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Daniel T. Gynn wrote:
> Has anyone installed Tomcat 5 on WBEL? And if so, do you know where I
> can find an RPM to do it?
I did not find an RPM either, and decided to add tomcat semi-manually.
By "semi" I mean I wanted to use stock distributions of Java and tomcat
and have some nice scripts that would get this running at boot time,
play by the WBEL rules and be general enough to be useful for later
releases of tomcat and the Sun JDK.
I have included my scripts and a README file; all whipped up just now
and for my project's internal use so please excuse the terseness. Still,
hopefully someone might find them somewhat useful.
Prerequisites
=============
A working JDK, mine is from Sun, and the latest tomcat tar ball unpacked
somewhere, in my case /opt/. A special tomcat user ("tomcat") added to
the system and all files tomcat belonging to this user.
Procedure
=========
Check the "tomcat.sysconfig" script for sanity and then run the
"install.tomcat" script. After this try
/etc/init.d/tomcat start
for laughs... :-)
Covering my posterior
=====================
This works at my site but YMMV.
Cheers!
Karl-Koenig Koenigsson
--
Karl-Koenig Koenigsson, CM Pablo
Black holes are where god divided by 0.
--------------080105050607030108000603
Content-Type: text/plain;
name="tomcat.sysconfig"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="tomcat.sysconfig"
#
# Apache tomcat WBEL configuration parameters
# by Karl-Koenig Koenigsson
#
# $Id: tomcat.sysconfig,v 1.1 2004/05/17 06:59:22 koenig Exp $
#
# This is where the JDK is installed. This value is the default
# from the Sun JDK installation
#
JAVA_HOME=/usr/java/j2sdk1.4.2_04
# This is the directory where tomcat is installed. Since tomcat
# comes in a tar file, it is just a matter of taste where to
# put it
#
CATALINA_HOME=/opt/tomcat
CATALINA_BASE=${CATALINA_HOME}
# It is always a good thing to have a specific user associated with
# an application of this type. Make sure that
#
# 1) the user exists, and
# 2) all files under $CATALINA_HOME are owned by this user
#
CATALINA_USER=tomcat
# These are the start and stop commands to the init script for
# tomcat. I don't know why I put them here, to be honest, or if they
# are really necessary. I modelled this script on others from WBEL and
# thought it was a good idea at the time...
#
TOMCAT_START="start"
TOMCAT_STOP="stop"
--------------080105050607030108000603
Content-Type: text/plain;
name="README"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="README"
#
# $Id: README,v 1.2 2004/05/17 07:14:53 koenig Exp $
#
LOCALLY ADDED OR CHANGED FILES FOR THE WBEL DISTRIBUTION
tomcat
=====
Installation
Download the latest tomcat release from http://jakarta.apache.org/tomcat/ and
install it somewhere, typically in /opt/
Edit the tomcat.sysconfig file to reflect the state of your system and then
run install.tomcat to copy the files and install the service.
Known bugs
The PID is not really saved as it should which means that the Service
Configuration application gets confused. Still, the program runs and
functions as expected so there you are... :-)
--------------080105050607030108000603
Content-Type: text/plain;
name="tomcat.init"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="tomcat.init"
#!/bin/bash
#
# Startup script for Tomcat, the Apache Servlet Engine
# by Karl-Koenig Koenigsson
#
# $Id: tomcat.init,v 1.1 2004/05/17 06:59:22 koenig Exp $
#
# chkconfig: 345 80 20
# description: The Apache tomcat JSP server
# processname: tomcat
# pidfile: /var/run/tomcat.pid
# config: /etc/sysconfig/tomcat
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/tomcat ]; then
. /etc/sysconfig/tomcat
fi
RETVAL=0
LANG=sv_SE
# start and stop functions
start() {
echo -n $"Starting Tomcat: "
cd ${CATALINA_HOME}
su - ${CATALINA_USER} -c "LANG=${LANG} ${CATALINA_HOME}/bin/catalina.sh ${TOMCAT_START}"
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat
return $RETVAL
}
stop() {
echo -n $"Stopping Tomcat: "
su - ${CATALINA_USER} -c "${CATALINA_HOME}/bin/catalina.sh ${TOMCAT_STOP}"
RETVAL=$?
sleep 2
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat /var/run/tomcat.pid
rm -rf /opt/tomcat/work/*
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status tomcat
;;
*)
echo "Usage: $0 start|stop|restart"
exit 1
esac
exit $RETVAL
--------------080105050607030108000603
Content-Type: text/plain;
name="install.tomcat"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="install.tomcat"
#
# Apache tomcat WBEL installation script
# by Karl-Koenig Koenigsson
#
# $Id: install.tomcat,v 1.2 2004/05/17 07:14:53 koenig Exp $
#
cp -v tomcat.init /etc/init.d/tomcat
cp -v tomcat.sysconfig /etc/sysconfig/tomcat
chkconfig --add tomcat
--------------080105050607030108000603--