Here's a startup script that I wrote:
#!/bin/sh
#
# Startup wrapper sript for Tomcat
# Sets up the environment variables needed to run Tomcat and then calls
# the proper tomcat script
#
# chkconfig: - 85 15
# description: Tomcat is a servlet engine.
#
# Geoff Lane <[EMAIL PROTECTED]>
# 1/5/2001
# Environment variables
OS=`uname`
# Solaris takes different options
if [ $OS = SunOS ]; then
TOMCAT_OPTS="-Xms16m -Xmx128m -native"
else
TOMCAT_OPTS="-Xms16m -Xmx128m"
fi
CLASSPATH=<Additional classpath>
TOMCAT_HOME=<path to tomcat_home>
ANT_HOME=<ant home - might not need this>
JAVA_HOME=<java home>
export JAVA_HOME TOMCAT_HOME CLASSPATH ANT_HOME TOMCAT_OPTS
# error "description"
error () {
echo $0: $* 2>&1
exit 1
}
# find the named process(es)
findproc() {
pid=`/bin/ps -ef |
/bin/grep -w $1 |
/bin/grep -v norestart |
/bin/grep -v grep |
/bin/awk '{print $2}'`
echo $pid
}
# kill the named process(es) (borrowed from S15nfs.server)
killproc() {
pid=`findproc $1`
[ "$pid" != "" ] && kill -9 $pid
}
case "$1" in
start)
$TOMCAT_HOME/bin/tomcat.sh start &
;;
stop)
$TOMCAT_HOME/bin/tomcat.sh stop
if [ $OS = SunOS ]; then
killproc tomcat
elif [ $OS = Linux ]; then
killall java
fi
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
This will work for both Solaris or Linux. Be sure to edit the
environment variables for your setup.
The process is a bit different for each of them on how to get it to
start on boot. With Red Hat at least, there is a utility called
'chkconfig'. After you copy this file into /etc/init.d - run 'chkconfig
--add tomcat'. Then run 'chkconfig --level 345 tomcat on' to turn it on
for runlevels 3, 4, and 5.
Hope that helps.
Dario Novakovic wrote:
>
> i run tomcat3.2 on linux box and i haven't got much expirience with linux so
> idon't know how to load tomcat on startup and i have to start ti allways
> manualy. i tryed placing startup.sh in rclocal and rcd.3 but it didn't work.
> what is a proper way to make tomcat start everytime my box is booted.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
--
Geoff Lane <[EMAIL PROTECTED]>
(650) 969-5000 x104
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]