You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Wright <At...@btinternet.com> on 2000/10/03 22:29:14 UTC

using init.d script to start tomcat

Apache 1.3.12/Tomcat3.1/Turbolinux6.0.2

I am 2 weeks into my introduction to Linux/Apache/Tomcat etc so please
forgive if this question serves only to highlight my ignorance.

I have got everything configured and running just fine so that the jsp
examples run from a browser on a networked machine.

After finding a script on the apache site by a Manik Surtani for
starting tomcat via init.d I changed it slightly as below and set up the
links for startup and shutdown at the various runlevels required.  It
seems to work ok in that on reboot the JSP stuff works fine.  However
after startup a bunch of java class paths appear on screen followed by a
pause then the login prompt.  Then after another longer pause I get lots
of stuff sent to the screen with lines starting "context log:......."

These messages did not appear when I ran the tomcat.sh start script by
hand.  This only confuses me because the script below seems to me to do
little more than run the tomcat.sh start script anyway.

Everything still seems to work just fine but I don't understand this and
it makes me nervous!

If anyone out there could explain this and suggest something to tidy it
up I would be very grateful.

Thanks for taking the time to read this.

Alan Wright



#!/bin/sh
#
# Startup script for Tomcat
#
# chkconfig: 345 86 14
# description: Tomcat used to serve JSP pages\
# processname: n/a (runs under jvm)
# pidfile: /var/run/tomcat.pid
# config: /opt/jakarta-tomcat/conf/custom-tomcat-apache.conf


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

source /root/.bashrc
export TOMCAT_HOME=/opt/jakarta-tomcat
export CLASSPATH=$JAVA_HOME/lib:/opt/jakarta-tomcat/classes

# added by wrighta - so tomcat start can find java
PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3/bin"
export PATH

# See how we were called.
case "$1" in
  start)
 echo -n "Starting Tomcat: "
 daemon $TOMCAT_HOME/bin/tomcat.sh start
 echo
 ;;
  stop)
 echo -n "Shutting down Tomcat: "
 daemon $TOMCAT_HOME/bin/tomcat.sh stop
 echo
 ;;
  restart)
 $0 stop
 $0 start
 ;;
  *)
 echo "Usage: $0 {start|stop|restart}"
 exit 1
esac

exit 0