Ubuntu Dapper Tomcat 5.5 start-stop problems and autostart script
Jagdish rao
aquajags at yahoo.com
Wed Aug 30 07:19:10 UTC 2006
hi experts
i have Ubuntu dapper with j2sdk1.5
i downloaded apache-tomcat-5.5.17 and unzipped into usr/local/
i have downloaded tomcat5 script for auto starting tomcat and easy start stop and status checking of tomcat.
i have some problems
1. when i execute the script
/etc/init.d/tomcat5 start . i get the err mess as
Starting Tomcat 5 servlet engine using Java from /usr/lib/j2sdk1.5-sun: cat: /etc/tomcat5/policy.d/*.policy: No such file or directory
actually there is no such directory in etc/init.d.i guess its created when tomcat is installed using apt-get tool.
the read the script .its copying the contents of these files to the
CATALINA_HOME(/usr/local/tomcat5517)/conf/catalina.polify file
pls help how can i make this script work i like this script bcos this script kills tomcat process
after timeout 0f 30 secs(or as specified in script)
i have posted the script below(pls check)
Problem No 2:
---------------------------------------------------------
when i sart tomcat i get this mess abt AprLifecycleListener lifecycleEvent optimizing
tomcats performance.pls tell what can i do to optimize tomcat
root at ublueshoe:/usr/local/tomcat/bin# ./catalina.sh run &
[3] 25004
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/lib/j2sdk1.5-sun
root at ublueshoe:/usr/local/tomcat/bin# Aug 25, 2006 10:34:38 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/j2sdk1.5-sun/jre/lib/i386/client:/usr/lib/j2sdk1.5-sun/jre/lib/i386:/usr/lib/j2sdk1.5-sun/jre/../lib/i386
Au
Problem No 3
--------------------------------------------------
when i shutdown tomcat i get thsi error mess as failed to shutdown pls help
root at ublueshoe:/usr/local/tomcat/bin# ./catalina.sh stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/lib/j2sdk1.5-sun
Aug 25, 2006 4:49:02 AM org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
root at ublueshoe:/usr/local/tomcat/bin# Aug 25, 2006 4:49:03 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Aug 25, 2006 4:49:03 AM org.apache.coyote.http11.Http11BaseProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Aug 25, 2006 4:49:03 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Failed shutdown of Apache Portable Runtime
The tomcat startup script
-----------------------------------------------------
#! /bin/sh -e
#
# /etc/init.d/tomcat5 -- startup script for the Tomcat 5 servlet engine
#
# Written by Miquel van Smoorenburg <miquels at cistron.nl>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock at gnu.ai.mit.edu>.
# Modified for Tomcat by Stefan Gybas <sgybas at debian.org>.
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=tomcat5
DESC="Tomcat 5 servlet engine"
CATALINA_HOME=/usr/local/tomcat5517
DAEMON=$CATALINA_HOME/bin/catalina.sh
DEFAULT=/etc/default/$NAME
# The following variables can be overwritten in $DEFAULT
# Run Tomcat 5 as this user ID
TOMCAT5_USER=root
# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr/lib/j2sdk1.5-sun"
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/usr/local/tomcat5517
# Use the Java security manager? (yes/no)
TOMCAT5_SECURITY=yes
# Timeout in seconds for the shutdown of all webapps
TOMCAT5_SHUTDOWN=30
# End of variables that can be overwritten in $DEFAULT
# overwrite settings from default file
if [ -f "$DEFAULT" ]; then
. "$DEFAULT"
fi
test -f $DAEMON || exit 0
if [ `id -u` -ne 0 ]; then
echo "Not starting/stopping $DESC, you are not root."
exit 4
fi
if [ -z "$TOMCAT5_USER" ]; then
echo "Not starting/stopping $DESC as configured (TOMCAT5_USER is"
echo "empty in $DEFAULT)."
exit 0
fi
# Look for the right JVM to use
for jdir in $JDK_DIRS; do
if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
JAVA_HOME_TMP="$jdir"
# checks for a real JDK like environment, needed to check if
# really the java-gcj-compat-dev package is installed
if [ -r "$jdir/bin/jdb" ]; then
JAVA_HOME="$JAVA_HOME_TMP"
fi
fi
done
export JAVA_HOME
# Set java.awt.headless=true if CATALINA_OPTS is not set so the
# Xalan XSL transformer can work without X11 display on JDK 1.4+
# It also looks like the default heap size of 64M is not enough for most cases
# so the maximum heap size is set to 128M
if [ -z "$CATALINA_OPTS" ]; then
CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M"
fi
# Set the JSP compiler if set in the tomcat5.default file
if [ -n "$JSP_COMPILER" ]; then
CATALINA_OPTS="$CATALINA_OPTS -Dbuild.compiler=$JSP_COMPILER"
fi
# Define other required variables
CATALINA_PID="$CATALINA_BASE/temp/$NAME.pid"
STARTUP_OPTS=""
if [ "$TOMCAT5_SECURITY" = "yes" ]; then
STARTUP_OPTS="-security"
fi
# Look for Java Secure Sockets Extension (JSSE) JARs
if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then
JSSE_HOME="${JAVA_HOME}/jre/"
fi
export CATALINA_HOME CATALINA_BASE CATALINA_OPTS CATALINA_PID JSSE_HOME
case "$1" in
start)
if [ -z "$JAVA_HOME" ]; then
echo "Could not start $DESC because no Java Development Kit"
echo "(JDK) was found. Please download and install JDK 1.3 or higher and set"
echo "JAVA_HOME in $DEFAULT to the JDK's installation directory."
exit 0
fi
if [ ! -d "$CATALINA_BASE/conf" ]; then
echo "Not starting Tomcat 5: Invalid CATALINA_BASE specified in $DEFAULT"
exit 1
fi
echo -n "Starting $DESC using Java from $JAVA_HOME: "
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
--user $TOMCAT5_USER --startas "$JAVA_HOME/bin/java" \
>/dev/null; then
# Create catalina.policy (for the security manager)
rm -f "$CATALINA_BASE/conf/catalina.policy"
umask 022
echo "// AUTO-GENERATED FILE -- DO NOT EDIT!" \
> "$CATALINA_BASE/conf/catalina.policy"
echo "// Edit the files in /etc/tomcat5/policy.d/ instead" \
>> "$CATALINA_BASE/conf/catalina.policy"
echo "" >> "$CATALINA_BASE/conf/catalina.policy"
cat /etc/tomcat5/policy.d/*.policy \
>> "$CATALINA_BASE/conf/catalina.policy"
# Clean up and set permissions on required files
rm -rf "$CATALINA_BASE"/temp/* \
"$CATALINA_BASE/logs/catalina.out"
mkfifo -m700 "$CATALINA_BASE/logs/catalina.out"
chown --dereference "$TOMCAT5_USER" "$CATALINA_BASE/conf" \
"$CATALINA_BASE/conf/tomcat-users.xml" \
"$CATALINA_BASE/logs" "$CATALINA_BASE/temp" \
"$CATALINA_BASE/webapps" "$CATALINA_BASE/work" \
"$CATALINA_BASE/logs/catalina.out" || true
# Look for rotatelogs/rotatelogs2
if [ -x /usr/sbin/rotatelogs ]; then
ROTATELOGS=/usr/sbin/rotatelogs
else
ROTATELOGS=/usr/sbin/rotatelogs2
fi
# -p preserves the environment (for $JAVA_HOME etc.)
# -s is required because tomcat5's login shell is /bin/false
su -p -s /bin/sh $TOMCAT5_USER \
-c "$ROTATELOGS \"$CATALINA_BASE/logs/catalina_%F.log\" 86400" \
< "$CATALINA_BASE/logs/catalina.out" &
su -p -s /bin/sh $TOMCAT5_USER \
-c "\"$DAEMON\" start $STARTUP_OPTS" \
>> "$CATALINA_BASE/logs/catalina.out" 2>&1
echo "$NAME."
else
echo "(already running)."
fi
;;
stop)
echo -n "Stopping $DESC: "
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
--user "$TOMCAT5_USER" --startas "$JAVA_HOME/bin/java" \
>/dev/null; then
echo "(not running)."
else
su -p -s /bin/sh $TOMCAT5_USER -c "\"$DAEMON\" stop" \
>/dev/null 2>&1 || true
# Fallback to kill the JVM process in case stopping didn't work
sleep 1
while ! start-stop-daemon --test --start \
--pidfile "$CATALINA_PID" --user "$TOMCAT5_USER" \
--startas "$JAVA_HOME/bin/java" >/dev/null; do
sleep 1
echo -n "."
TOMCAT5_SHUTDOWN=`expr $TOMCAT5_SHUTDOWN - 1` || true
if [ $TOMCAT5_SHUTDOWN -le 0 ]; then
echo -n " (killing) "
start-stop-daemon --stop --signal 9 --oknodo \
--quiet --pidfile "$CATALINA_PID" \
--user "$TOMCAT5_USER"
fi
done
rm -f "$CATALINA_PID" "$CATALINA_BASE/logs/catalina.out"
echo "$NAME."
fi
;;
status)
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
--user $TOMCAT5_USER --startas "$JAVA_HOME/bin/java" \
>/dev/null; then
if [ -f "$CATALINA_PID" ]; then
echo "$DESC is not running, but pid file exists."
exit 1
else
echo "$DESC is not running."
exit 3
fi
else
echo -n "$DESC is running with Java pid "
cat "$CATALINA_PID"
exit 0
fi
;;
reload)
echo "Reload is not implemented!" >&2
exit 3
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: /etc/init.d/tomcat5 {start|stop|restart|force-reload|status}" >&2
exit 2
;;
esac
exit 0
------------------------------------------------------------------------------------------
thanks n regs
jags
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060830/dff9e7b9/attachment.html>
More information about the ubuntu-users
mailing list