tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klotz Jr, Dennis" <DKl...@empirix.com>
Subject RE: Jsvc vs tomcat shutdown -force
Date Tue, 01 Nov 2005 14:19:54 GMT
Now this is under Suse 9.2 linux, so keep that in mind ;)

Create a file such as tomcat5 in /etc/init.d with the contents:

#!/bin/sh
#   
# Startup script for the tomcat 5 Server
#
# chkconfig: 345 92 8
# description: tomcat is a jsp and servlet Web server.  It is used to
serve \
#              HTML files, jsp and servlet content.
# processname: jsvs.exec (the helper class to start tomcat as root and
then change to a new user)
# pidfile: /var/run/jsvc

# Source function library.
. /etc/init.d/functions


JAVA_HOME=/usr/java/jdk1.5.0_04
CATALINA_HOME=/usr/java/jakarta-tomcat-5.5.9
DAEMON_HOME=/usr/java/jakarta-tomcat-5.5.9/bin/jsvc-src
TOMCAT_USER=tomcat
TMP_DIR=/var/tmp
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar:\
$CATALINA_HOME/shared/lib/jni.jar:\
$CATALINA_HOME/webapps/ActiveProbe/classes

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export DISPLAY=127.0.0.1:1.0

case "$1" in
  start)
    #
    # Start Tomcat
    #
if [ -e /var/run/jsvc.pid ] 
then
        echo "tomcat is already running..."
else 
   $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 $CATALINA_HOME/logs/catalina.err \
   $CATALINA_OPTS \
   -cp $CLASSPATH \
   org.apache.catalina.startup.Bootstrap
   touch /var/lock/subsys/tomcat5
fi
    ;;
  stop)
    #
    # Stop Tomcat
    #
    PID=`cat /var/run/jsvc.pid`
    kill $PID
    rm -f /var/lock/subsys/tomcat5
    rm -f /var/run/jsvc.pid
    ;;
  status)
        echo
        if [ -e /var/run/jsvc.pid ]; then 
                gprintf "Tomcat is running.\n"
                echo
        fi
        if [ ! -e /var/run/jsvc.pid ]; then     
                gprintf "Tomcat is *not* running.\n"
                echo
        fi
        echo
        ;;
  restart|reload)
        # do not do anything; this is unreasonable
        :
        ;;
  *)
    echo "Usage tomcat5 start/status/stop"
    exit 1;;


If I remember right I had to unpack and compile jsvc. I think that is
all there is to it. This starts tomcat at root, via the init.d startup
process, and then switches the process to the user specified by
$TOMCAT_USER. Works great.

-Dennis



-----Original Message-----
From: Preston Crawford [mailto:me@prestoncrawford.com] 
Sent: Monday, October 31, 2005 6:00 PM
To: Tomcat Users List
Subject: RE: Jsvc vs tomcat shutdown -force

How did you get this to work? I tried following the directions and it
doesn't work for me.

Preston

> I've used jsvc to have tomcat start as root and then switch to tomcat
> user. This way I can have tomcat run on port 80 on a linux box.
>
> -Dennis
>
> -----Original Message-----
> From: Matteo Turra [mailto:mturra@kion.it]
> Sent: Monday, October 31, 2005 12:11 PM
> To: users@tomcat.apache.org
> Subject: Jsvc vs tomcat shutdown -force
>
> Hi, I was wondering what jsvc is for? I tought it was to shutdown
tomcat
> if it hangs and does not listen on shutdown port.
> Now I learn I can use CATALINA_PID and the -force parameter to kill
> tomcat if shutdown fails, isn'it?
>
> Thanks.
>
> Matteo.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



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


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


Mime
View raw message