Automatic startup and shutdown of Tomcat
Archive - Originally posted on "The Horse's Mouth" - 2008-02-24 05:30:38 - Graham EllisSetting up Tomcat to shutdown and startup automatically when the Linux / Unix server restarts. The following is for Fedora Linux, with Tomcat installed at /usr/local/tomcat (probably via a symlink as taught on our deployment course). Server configuration - assuming a default run state of 3.
1. Copy catalina.sh to /etc/init.d/tomcatrun
2. Add the following after the #! line but before any executable code
CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME
PATH=/usr/local/java/bin:$PATH
export PATH
JAVA_HOME=/usr/local/java
export JAVA_HOME
3. Add the following symlinks in the /etc/rc3.d directory
lrwxrwxrwx 1 root root 19 Feb 23 10:37 K04tomcat -> ../init.d/tomcatrun
lrwxrwxrwx 1 root root 19 Feb 23 10:37 S98tomcat -> ../init.d/tomcatrun
Let me stress - this is an example - you may have differences depending on the OS flavour, default run state, install directory for Tomcat, and other daemons that you are starting.