Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I installed tomcat servlet but i need to autostart while booting.How to?

share|improve this question
up vote 2 down vote accepted

You need to create an init script for tomcat and add it to the correct runlevel init script.

Advice adapted from here

Create an init script /etc/init.d/tomcat/ for tomcat, changing the value for catalina home to the correct location:

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

# Source function library.
. /etc/init.d/functions


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

exit $RETVAL

Then add a link to the rc5.d folder - /etc/rc5.d/

sudo ln -s /etc/init.d/tomcat /etc/rc5.d/S71tomcat
share|improve this answer
i'll test it then i'll provide you with results – user93206 Oct 9 '12 at 13:21
How did you get on? – niallhaslam Oct 10 '12 at 17:28

Incase you know the service name then autostart it using the method given in

How can I configure a service to run at startup

share|improve this answer

Your Answer


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