Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can any one share their Tomcat startup script I am looking for a tomcat start up script on a Ubuntu machine. My Ubuntu is 10.04 server. The tomcat is 5.5.30.

It is in /opt/apache-tomcat-5.5.31

I tried a script

# tomcat
# chkconfig:
# description: Start up the Tomcat servlet engine.

# Source function library.
. /lib/lsb/init-functions


case "$1" in
if [ -f $CATALINA_HOME/bin/ ];
echo $"Starting Tomcat"

if [ -f $CATALINA_HOME/bin/ ];
echo $"Stopping Tomcat"
echo $"Usage: $0 {start|stop}"
exit 1
exit $RETVAL 

but it did not worked after a reboot. But the same script works if I do /etc/init.d/tomcat start or /etc/init.d/tomcat stop I have done
update-rc.d tomcat defaults
as it is a Ubuntu server but on reboot all of this fails to work.

share|improve this question
up vote 1 down vote accepted

For some weired reason the script was not working after reboot and it turns out that Tomcat needs JAVA_HOME variable to be able to start itself.This variable I had defined in .bashrc but this script was still not able to work.So when I defined JAVA_HOME in the above script also then it did worked.

share|improve this answer

To start a service on boot, the init script should be in the directory /etc/init.d, but the real start and stop are triggered by the symbolic links in the directories /etc/rcX.d (X being the runlevel number).

On Debian derivatives like Ubuntu, when your init script is in /etc/init.d, you can use update-rc.d to create the links, for example if your init script is called tomcat :

update-rc.d tomcat default
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.