Pat,
     See reply below.  I left out the left curly brace in the   if [ ! -x 
${JSVC_BIN} ]; then
statement.  Sorry, didn't proof-read before I hit send...
> 
> From: Warren Pace <[EMAIL PROTECTED]>
> Date: 2006/08/03 Thu PM 05:20:47 EDT
> To: "Tomcat Users List" <users@tomcat.apache.org>
> Subject: Re: how to use jsvc to stop the tomcat service
> 
> 
> > 
> > From: "Patrick Wang" <[EMAIL PROTECTED]>
> > Date: 2006/08/03 Thu PM 02:27:35 EDT
> > To: "'Tomcat Users List'" <users@tomcat.apache.org>
> > Subject: how to use jsvc to stop the tomcat service
> > 
> > Hi All:
> > 
> > I am using TOMCAT 5.0.28, I found the following command to start a tomcat
> > instance on the documentation page, however it did not mention how to stop 
> > the
> > tomcat, I am currently using kill <<processed>> and wondering if there is a 
> > more
> > elegant solution.
> > 
> > Thanks
> > 
> > Pat
> > ===============================================================================
> > 
> > ./bin/jsvc -Djava.endorsed.dirs=./common/endorsed -cp ./bin/bootstrap.jar \
> >         -outfile ./logs/catalina.out -errfile ./logs/catalina.err \
> >         org.apache.catalina.startup.Bootstrap
> > 
> write a shell script for init.d something like the one listed below named 
> tomcat5, make it executable and save it in /etc/init.d.  You can specify 
> processes you need to have running before tomcat starts,etc.  Since I use 
> jdbc realms, I specify that mysql should be running before tomcat starts. Of 
> course, you'll have to change these paths to match your system.  Then you can 
> start, stop or restart tomcat by typing in /etc/init.d/tomcat5 start or 
> /etc/init.d/tomcat5 stop or /etc/init.d/tomcat5 restart.  You'll want to play 
> with the Xms/Xmx section to set the minium & maximum system memory you allow.
> You should be able to use the script to start tomcat at system startup as 
> well.
> 
> #!/bin/sh
> # /etc/init.d/tomcat5
> #
> ### BEGIN INIT INFO
> # Provides:             tomcat5
> # Required-Start:   $network $remote_fs mysql
> # X-UnitedLinux-Should-Start:
> # Required-Stop:   $network $remote_fs mysql
> # X-UnitedLinux-Should-Stop:
> # Default-Start:       3 5
> # Default-Stop:       0 1 2 6
> # Description:         Apache-Tomcat Servlet Container
> ### END INIT INFO
> JAVA_HOME=/usr/lib/jvm/java
> CATALINA_HOME=/usr/share/tomcat5
> DAEMON_HOME=/usr/share/tomcat5
> TOMCAT_USER=tomcat
> 
> TMP_DIR=/var/tmp
> PID_FILE=/var/run/jsvc.pid
> CATALINA_TMPDIR=/usr/share/tomcat5/temp
> CATALINA_OPTS="-Djava.endorsed.dirs=$CATALINA_HOME/common/endorsed"
> CLASSPATH=\
> $JAVA_HOME/lib/tools.jar:\
> $CATALINA_HOME/bin/commons-daemon.jar:\
> $CATALINA_HOME/bin/bootstrap.jar
> JSVC_BIN=$DAEMON_HOME/bin/jsvc
> 
> . /etc/rc.status
> rs_reset
> 
> if [! -x $JSVC_BIN} ]; then
>     echo -n >$2 "Cannot run Tomcat, ${JSVC_BIN}  not present. "
>     rc_status -s
>     exit 5
> fi
> 
> case "$1" in
>     start)
>     #
>     # Start Tomcat
>     echo -n "Starting service Tomcat 5.0.28 Servlet Container "
>     checkproc -p ${PID_FILE} ${JSVC_BIN}
>    case $? in
>         0) echo -n " - Warning:  daemon already running. ";;
>         1) echo -n " - Warning: ${PID_FILE} exists.  ";;
>     esac
>     $DAEMON_HOME/bin/jsvc \
>     -user $TOMCAT_USER \
>     -home $JAVA_HOME \
>     -Dcatalina.home=$CATALINA_HOME \
>     -Dcatalina.tmpdir=$CATALINA_TMPDIR \
>     -Djava.io.tmpdir=$TMP_DIR \
>     -wait 10 \
>     -pidfile $PID_FILE \
>     -outfile $CATALINA_HOME/logs/catalina.out \
>     -errfile '&1' \
>     $CATALINA_OPTS \
>       -Xms64M -Xmx128M \
>     -cp $CLASSPATH \
>     org.apache.catalina.startup.Bootstrap \
>     chown -R -H --dreference tomcat:tomcat $CATALINA_HOME/*
>     rc_status -v
>     ;;
>   
>   stop)
>     # Stop Tomcat
>     echo -n "Stopping service Tomcat 5.0.28 Servlet Container "
>     $DAEMON_HOME/bin/jsvc \
>     -stop \
>     -pidfile $PID_FILE \
>     org.apache.catalina.startup.Bootstrap
>     rc_status -v
>     ;;
> 
>   restart|reload|force-reload)
>     $0 stop
>     $0 start
>     ;;
> 
>   status)
>       echo -n "Checing status of Tomcat 5.0.28 Servlet Container "
>       checkproc -p ${PID_FILE} ${JSVC_BIN}
>       rc_status -v
>   *)
>       echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"
>       exit 1;;
> esac
> rc_exit
> 
> 
> 
> 
> > 
> > 
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to