Running TomCat 5.5 as Linux Daemon
Perform standard Tomat 5.5.X server install by account "tomcat".
Compile as officially advised in [1] $CATALINA_HOME/bin/jsvc binary :-
cd $CATALINA_HOME/bin
tar xvfz jsvc.tar.gz
cd jsvc-src
autoconf
./configure
make
cp jsvc ..
cd ..
To be succeed starting up TomCat's jsvc daemon with JDK 1.5
create as root script "/etc/init.d/TomCatJsvc",
compare it with daemon startup script suggested in [1]:-
JAVA_HOME='/home/tomcat/jdk1.5.0_06'
CATALINA_HOME='/home/tomcat/apache-tomcat-5.5.16'
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar:$JAVA_HOME/lib/tools.jar
TOMCAT_USER=tomcat
TMPDIR=/var/tmp
RC=0
case "$1" in
start)
$CATALINA_HOME/bin/jsvc -user $TOMCAT_USER -home $JAVA_HOME -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$TMPDIR -Djava.awt.headless=true -outfile $CATALINA_HOME/logs/catalina.out -errfile $CATALINA_HOME/logs/catalina.err -cp $CLASSPATH org.apache.catalina.startup.Bootstrap
RC=$?
[ $RC = 0 ] && touch /var/lock/subsys/tomcat
;;
stop)
PID=`cat /var/run/jsvc.pid`
kill $PID
RC=$?
[ $RC = 0 ] && rm -f /var/lock/subsys/tomcat /var/run/jsvc.pid
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit $RC
Then run as root:-
# /etc/init.d/TomCatJsvc start
If "ps -ef|grep tomcat" output looks like:-
and $CATALINA_HOME/logs/catalina.out:-
then you should be fine with launching browser to http://localhost:8080.
For automatic startup/shutdown TomCat's daemon create 3 symbolic links:-
# ln -s /etc/init.d/TomCatJsvc /etc/rc5.d/S99TomCatJsvc
# ln -s /etc/init.d/TomCatJsvc /etc/rc0.d/K09TomCatJsvc
# ln -s /etc/init.d/TomCatJsvc /etc/rc6.d/K09TomCatJsvc
References
1.http://tomcat.apache.org/tomcat-5.5-doc/setup.html