I have found a file called tomcat5.5 in /etc/init.d/ which has the start-up 
script for Tomcat 5. Would I simply make a copy of this called tomcat6 and 
adjust the file to my specifics, or is there an easier way to do this? The text 
of the file is attached, if it is of any help, but from reading through it, it 
seems that most of it is for Tomcat in general and not the specific version, so 
I think simply editing it should work. I am not that familiar with such files, 
though - can anyone confirm/deny my guess? 

-----Original Message-----
From: Timo Meinen | mindmatters [mailto:timo.mei...@mindmatters.de] 
Sent: Monday, June 15, 2009 5:27 AM
To: Tomcat Users List
Subject: Re: Upgrade to Tomcat 6 on Ubuntu

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Neil,

we usually don't use the Tomcat installation provided by Ubuntu,  
because the files are distributed over the hole filesystem. e.g. conf  
under /etc. It's no problem to download a regular Tomcat-distribution  
as tar.gz or zip und unzip it into /opt/tomcat.

You can write a simple service-wrapper into /etc/init.d/tomcat to  
manage the server. This way you have all your information under /opt/ 
tomcat and it's although possible to install more than one server  
instance.

Best regards,

Timo Meinen

Am 12.06.2009 um 21:20 schrieb Mukerjee, Neiloy (Neil):

> I am running Ubuntu 8.04 and already have Tomcat 5.5 installed, but  
> I am told that in order to properly use another program (Solr 1.3),  
> it would be best for me to upgrade to Tomcat 6. However, I have  
> tried going through the regular install process of Tomcat 6, and it  
> doesn't seem to overwrite Tomcat 5.5 - am I misunderstanding  
> something or leaving a step out?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)

iEYEARECAAYFAko2FAMACgkQeh8+Xr6H+wnr9QCeKPSzXMb9d9Ygao6eQSv7mN96
RL4AnRAgoyrL9TQHUXN5OhBexsj8eO/x
=HTtM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

#!/bin/sh
#
# /etc/init.d/tomcat5.5 -- startup script for the Tomcat 5 servlet engine
#
# Written by Miquel van Smoorenburg <miqu...@cistron.nl>.
# Modified for Debian GNU/Linux by Ian Murdock <imurd...@gnu.ai.mit.edu>.
# Modified for Tomcat by Stefan Gybas <sgy...@debian.org>.
#
### BEGIN INIT INFO
# Provides:          tomcat
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Tomcat.
# Description:       Start the Tomcat servlet engine.
### END INIT INFO

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=tomcat5.5
DESC="Tomcat servlet engine"
DAEMON=/usr/bin/jsvc
CATALINA_HOME=/usr/share/$NAME
DEFAULT=/etc/default/$NAME

if [ `id -u` -ne 0 ]; then
        echo "You need root privileges to run this script"
        exit 1
fi
         
# Make sure tomcat is started with system locale
if [ -r /etc/default/locale ]; then
        . /etc/default/locale
        export LANG
fi

. /lib/lsb/init-functions
. /etc/default/rcS

# The following variables can be overwritten in $DEFAULT

# Run Tomcat 5 as this user ID
TOMCAT5_USER=tomcat55

# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun 
/usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-ibm 
/usr/lib/j2sdk1.4-sun /usr/lib/j2sdk1.4-blackdown /usr/lib/j2se/1.4 
/usr/lib/j2sdk1.4-ibm /usr/lib/j2sdk1.3-sun /usr/lib/j2sdk1.3-blackdown 
/usr/lib/jvm/java-gcj /usr/lib/kaffe"

# 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="$jdir"
    fi
done
export JAVA_HOME

# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME

# Use the Java security manager? (yes/no)
#TOMCAT5_SECURITY=yes
TOMCAT5_SECURITY=no

# 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

[ -z "$TOMCAT5_USER" ] && TOMCAT5_USER=tomcat55

# Check if we use gij
gij=no
"$JAVA_HOME/bin/java" -version 2>&1 | grep -q "^gij (GNU libgcj)" && gij=yes

# gij doesn't support a security manager yet (see bug #399595)
if [ "$gij" = "yes" ]; then
    echo -e "The java-gcj-compat-dev environment currently doesn't\nsupport a 
security manager. See README.Debian." | logger -p daemon.warning -t $NAME
fi

# Set java.awt.headless=true if JAVA_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
# se the maximum heap size is set to 128M
if [ -z "$JAVA_OPTS" ]; then
        JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"
fi

JAVA_OPTS="$JAVA_OPTS -Djava.endorsed.dirs=$CATALINA_HOME/common/endorsed 
-Dcatalina.base=$CATALINA_BASE -Dcatalina.home=$CATALINA_HOME 
-Djava.io.tmpdir=$CATALINA_BASE/temp"

# Set the JSP compiler if set in the tomcat5.5.default file
if [ -n "$JSP_COMPILER" ]; then
        JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=$JSP_COMPILER"
fi

if [ "$TOMCAT5_SECURITY" = "yes" ]; then
        JAVA_OPTS="$JAVA_OPTS -Djava.security.manager 
-Djava.security.policy=$CATALINA_BASE/conf/catalina.policy"
fi

# juli LogManager disabled if running under gij (see bug #395167)
if [ "$gij" != "yes" ]; then
        JAVA_OPTS="$JAVA_OPTS 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
fi

# Define other required variables
CATALINA_PID="/var/run/$NAME.pid"
BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap
JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar"

# 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 JSSE_HOME

case "$1" in
  start)
        if [ -z "$JAVA_HOME" ]; then
                log_failure_msg "no JDK found - please set JAVA_HOME"
                exit 1
        fi

        if [ ! -d "$CATALINA_BASE/conf" ]; then
                log_failure_msg "invalid CATALINA_BASE specified"
                exit 1
        fi

        log_daemon_msg "Starting $DESC" "$NAME"
        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.5/policy.d/ instead" \
                        >> "$CATALINA_BASE/conf/catalina.policy"
                echo ""  >> "$CATALINA_BASE/conf/catalina.policy"
                cat /etc/tomcat5.5/policy.d/*.policy \
                        >> "$CATALINA_BASE/conf/catalina.policy"

                # Clean up and set permissions on required files
                find "$CATALINA_BASE"/temp/ -mindepth 1 -exec rm -fr {} +
                REQUIRED_FILES='"$CATALINA_BASE/conf"
                        "$CATALINA_BASE/logs" "$CATALINA_BASE/temp"
                        "$CATALINA_BASE/webapps" "$CATALINA_BASE/work"'
                if [ -e "$CATALINA_BASE/conf/tomcat-users.xml" ]; then
                        REQUIRED_FILES=$REQUIRED_FILES'
                                "$CATALINA_BASE/conf/tomcat-users.xml"'
                fi
                eval chown --dereference "$TOMCAT5_USER" $REQUIRED_FILES \
                        || true

                $DAEMON -user "$TOMCAT5_USER" -cp "$JSVC_CLASSPATH" \
                    -outfile SYSLOG -errfile SYSLOG \
                    -pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"
        else
                log_progress_msg "(already running)"
        fi
        log_end_msg 0
        ;;
  stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
        if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
                --user "$TOMCAT5_USER" --startas "$JAVA_HOME/bin/java" \
                >/dev/null; then
                log_progress_msg "(not running)"
        else
                $DAEMON -cp "$JSVC_CLASSPATH" -pidfile "$CATALINA_PID" \
                     -stop "$BOOTSTRAP_CLASS"
        fi
        log_end_msg 0
        ;;
   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
                    log_success_msg "$DESC is not running, but pid file exists."
                else
                    log_success_msg "$DESC is not running."
                fi
        else
                log_success_msg "$DESC is running with pid `cat $CATALINA_PID`"
        fi
        ;;
  restart|force-reload)
        if start-stop-daemon --test --stop --pidfile "$CATALINA_PID" \
                --user $TOMCAT5_USER --startas "$JAVA_HOME/bin/java" \
                >/dev/null; then
                $0 stop
                sleep 1
        fi
        $0 start
        ;;
  try-restart)
        if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
                --user $TOMCAT5_USER --startas "$JAVA_HOME/bin/java" \
                >/dev/null; then
                $0 start
        fi
        ;;
  *)
        log_success_msg "Usage: $0 
{start|stop|restart|try-restart|force-reload|status}"
        exit 1
        ;;
esac

exit 0
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to