How can I start Tomcat as a daemon in Linux?

Alessandro A. Garbagnati

Unless you need the "status" functionality (that can be added, anyway), you can use '' (for Tomcat 4.x) or '' (tomcat 3.x) directly for that.

ln -s /usr/local/tomcat/bin/ /etc/rc.d/init.d/tomcat

Then based on the runlevel, you can create the Sxx and Kxx links in the appropriate directory. For example, if your runlevel is 3, put the file in rc3.d:

ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc3.d/S63tomcat
ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc3.d/K37tomcat
(change S63 and K37 according to your starting sequence).
For Tomcat 4.0.x just change with

Note: Remember to manually set CATALINA_HOME (for Tomcat 4.x) or TOMCAT_HOME (for Tomcat 3.x) and JAVA_HOME inside, because I'm not sure that the shell script, if executes from there, will be able to guess the two variables.