tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Muñoz <vic...@munoz.name>
Subject jsvc startup script Fedora-Red Hat
Date Thu, 10 Nov 2005 01:58:09 GMT
Just a small contribution. I have modified the file
$CATALINA_HOME/bin/jsvc/native/tomcat.sh found in the binary distribution of
Tomcat to suit my needs. Perhaps, this could be useful for other people in
the community. Maybe a committer could be interested. I also have some
installation notes (currently in Spanish) that reflect the behavior of the
current version (5.5.12.) I will gladly provide them if someone is
interested. If the documentation people is interested I can enhance and
translate them to English.

 

Victor

 

Two commands have bin added (i.e. restart and status)

 

#!/bin/sh

############################################################################
##

#

#   Copyright 2004 The Apache Software Foundation.

#

#   Licensed under the Apache License, Version 2.0 (the "License");

#   you may not use this file except in compliance with the License.

#   You may obtain a copy of the License at

#

#       http://www.apache.org/licenses/LICENSE-2.0

#

#   Unless required by applicable law or agreed to in writing, software

#   distributed under the License is distributed on an "AS IS" BASIS,

#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

#   See the License for the specific language governing permissions and

#   limitations under the License.

############################################################################
##

#

# Small shell script to show how to start/stop Tomcat using jsvc

# If you want to have Tomcat running on port 80 please modify the server.xml

# file:

#

#    <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->

#    <Connector className="org.apache.catalina.connector.http.HttpConnector"

#               port="80" minProcessors="5" maxProcessors="75"

#               enableLookups="true" redirectPort="8443"

#               acceptCount="10" debug="0" connectionTimeout="60000"/>

#

# That is for Tomcat-5.0.x (Apache Tomcat/5.0)

#

# Adapt the following lines to your configuration

JAVA_HOME=/opt/jdk1.5.0_03

CATALINA_HOME=/home/tomcat/jakarta-tomcat

DAEMON_HOME=/home/tomcat/jakarta-tomcat/bin

TOMCAT_USER=tomcat

TMP_DIR=/var/tmp

CATALINA_OPTS=

CLASSPATH=\

$JAVA_HOME/lib/tools.jar:\

$CATALINA_HOME/bin/commons-daemon.jar:\

$CATALINA_HOME/bin/bootstrap.jar

 

prog="Tomcat Server"

pid=`cat /var/run/jsvc.pid`

 

# Source function library.

. /etc/rc.d/init.d/functions

 

start()

{

    #

    # Start Tomcat

    #

    $DAEMON_HOME/jsvc -user $TOMCAT_USER -home $JAVA_HOME \

    -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$TMP_DIR \

    -outfile $CATALINA_HOME/logs/catalina.out -errfile '&1' \

    $CATALINA_OPTS -cp $CLASSPATH org.apache.catalina.startup.Bootstrap 

    #

    # To get a verbose JVM

    # -verbose \

    # To get a debug of jsvc.

    # -debug \

    checkpid $pid

    ret=$?

    if [ $ret -eq 1 ]; then

        action $"Starting $prog: " /bin/true

    else

      action $"Starting $prog: " /bin/false

    fi

}

 

stop()

{

    # Stop Tomcat

    #

    kill $pid

    ret=$?

    if [ $ret -eq 0 ]; then

      action $"Stopping $prog: " /bin/true

    else

        action $"Stopping $prog: " /bin/false

    fi

}

 

restart()

{

    stop

    sleep 2

    start

}

 

 

case "$1" in

    start)

        start

        ;;

    stop)

        stop

        ;;

    status)

        status jsvc

        ;;

    restart)

        restart

        ;;

    *)

        echo $"Usage: $0 (start|stop|status|restart)"

        exit 1

esac

 

exit $?

 

 


Mime
View raw message