You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Fox <rf...@sbsii.com> on 2002/08/05 16:37:35 UTC
Tomcat 4.0.4 init.d startup script
Hi,
I am running Tomcat successfully on my RH 7.3 system with Apache. I want to
start tomcat automatically, of course, but am having a devil of a time
writing a startup script for init.d (I am no expert on shell scripts).
Currently I run Tomcat by hand with
/var/jakarta-tomcat-4.0.4/bin/startup.sh. I don't see a script that I can
copy to /etc/init.d. Could someone please provide me with this script? I am
sure it has been written thosands of times. Alternatively, I would really
appreciate help determining what is wrong with my current script, which
follows:
Here is the error when I run the script from the command line:
[rfox@thor bin]$ /etc/init.d/tomcat4 start
': not a valid identifierrt: `
/bin/catalina.sh: No such file or directory/jakarta-tomcat-4.0.4
Here is my script:
#!/bin/sh
#
# Startup script for the Apache Tomcat JSP/Servlet Container
#
# chkconfig: 345 85 15
# description: Apache Tomcat is a JSP/Servlet container. It is used to
serve \
# JSP pages and "execute" servlets.
# processname: XXX - fixme - XXX
# pidfile: none
# lockfile: /var/lock/subsys/tomcat4
# config: $CATALINA_HOME/conf/server.xml
# config: /etc/sysconfig/tomcat4
# Source function library.
. /etc/rc.d/init.d/functions
# Source additional OPTIONS if we have them.
if [ -f /etc/sysconfig/tomcat4 ] ; then
. /etc/sysconfig/tomcat4
fi
prog=tomcat4
start() {
echo -n $"Starting $prog: "
${CATALINA_HOME}/bin/catalina.sh start $2>&1
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat4
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
${CATALINA_HOME}/bin/catalina.sh stop $2>&1
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat4 /var/run/tomcat4.pid
}
status() {
echo -n $"Status $prog: not implemented yet!"
echo
RETVAL=1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 20
start
;;
*)
echo $"Usage: $prog {start|stop|restart}"
exit 1
esac
exit $RETVAL
Here is my /etc/sysconfig/tomcat4:
export JAVA_HOME=/usr/java/j2sdk1.4.0
export CATALINA_BASE=/var/jakarta-tomcat-4.0.4
export CATALINA_HOME=$CATALINA_BASE
tia,
Rich
rfox@sbsii.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>