Tomcat 5.5 not starting on boot
The problem I am having is I cannot seem to get Tomcat to start automatically when the linode is booted. I can login via SSH and enter "/etc/init.d/tomcat55 start" and it will start.
I have set the runlevel to be 3, 5 and set it to run on boot via webmin also but to no avail. I even tried creating a cronjob that would run the tomcat55 start command on boot but it says "failed" even when I test it.
Any help would be greatly appreciated
4 Replies
James
I finally just gave up and installed Tomcat 6.0.14 which incidentally is not available in an RPM but the installation is literally just untaring and putting it in some directory. Then it was just a matter of making a simple startup script:
#!/bin/bash
#
# tomcat boot script
RETVAL=$?
CATALINA_HOME="/tomcat6"
export JAVA_HOME="/usr/lib/jvm/java"
case $1 in
start)
sh /tomcat6/bin/startup.sh
;;
stop)
sh /tomcat6/bin/shutdown.sh
;;
restart)
sh /tomcat6/bin/shutdown.sh
sh /tomcat6/bin/startup.sh
;;
esac
exit 0
Placing it in /etc/init.d, Chmod +X starttomcat.sh
For some reason it would still return errors when set to boot so I just added a cronjob that executed "/etc/init.d/starttomcat.sh start" on boot.
This may not be the most elegant solution but until the tomcat RPM is fixed this is the only thing that worked for me. (The premade boot script also fails to work on my full desktop Suse 10.3 install so this is not an isolated occurance)
This is probably a better solution anyway since I decided not to use Apache and route to tomcat. Tomcat 5 was the first version to have a built in component for serving static content, Tomcat 6 has since improved making apache not needed (unless one wants/needs PHP)
I run Gentoo, but here's my init script which you should be able to easily adapt to SUSE:
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
need net
use apache dns logger netmount
after sshd
}
configtest() {
ebegin "Checking Apache Tomcat Configuration"
checkconfig
eend $?
}
checkconfig() {
[ -z ${JAVA_HOME} ] && return 1
[ -z ${CATALINA_HOME} ] && return 1
[ -z ${CATALINA_BASE} ] && return 1
return 0
}
start() {
checkconfig || return 1
ebegin "Starting tomcat"
cd ${CATALINA_HOME}
bin/jsvc -home ${JAVA_HOME} \
-Dcatalina.home=${CATALINA_HOME} \
-Dcatalina.base=${CATALINA_BASE} \
-Djava.endorsed.dirs=./common/endorsed \
-Djava.io.tmpdir=${CATALINA_BASE}/temp \
-cp ./bin/bootstrap.jar \
-user apache \
-wait 60 \
-outfile ${CATALINA_BASE}/logs/catalina.out \
-errfile ${CATALINA_BASE}/logs/catalina.err \
-pidfile /var/run/tomcat.pid \
org.apache.catalina.startup.Bootstrap
eend $?
}
stop() {
checkconfig || return 1
ebegin "Stopping tomcat"
cd ${CATALINA_HOME}
bin/jsvc -stop -home ${JAVA_HOME} \
-Dcatalina.home=${CATALINA_HOME} \
-Dcatalina.base=${CATALINA_BASE} \
-Djava.endorsed.dirs=./common/endorsed \
-Djava.io.tmpdir=${CATALINA_BASE}/temp \
-cp ./bin/bootstrap.jar \
-user apache \
-wait 60 \
-outfile ${CATALINA_BASE}/logs/catalina.out \
-errfile ${CATALINA_BASE}/logs/catalina.err \
-pidfile /var/run/tomcat.pid \
org.apache.catalina.startup.Bootstrap
eend $?
}
Fri Apr 18 07:15:49 EDT 2008
Hi ZunZun,
Regarding
*YaST2>System>System Services (Runlevel)>
*click on expert radio button,
*click on the service (You need to have copied it to the /etc/init.d folder 1st)
*click on the runlevel that you want (Probably 5).
I dont really want to register on the forum, so could you post the solution. SuSE is not my 1st choice but cron jobs are def my last.
Thanks,
Adam