- Extract the included commons-daemon source and build the jsvc tool for daemonizing Tomcat.
> tar xvfz commons-daemon-native.tar.gz
> cd commons-daemon-1.0.x-native-src/unix
> cp jsvc ../../
Note: You need a compiler, make and Java to build JSVC binary. If you do not have Java path environment (JAVA_HOME) predefined , you can run ./configure --with-java=/specify/path/to/java.
- Copy sample tomcat.sh (see Attachments) to $CATALINA_BASE/bin path, and use it to run to as a daemon. Make sure to setup the setenv.sh and the following variables in tomcat.sh for your deployment environment:
# Define the user we want to run Tomcat as
# Enabling or disabling the security manager in Tomcat?
# By default the security mechanism is disabled. Options: enable or disable
Note: You can copy the setenv.sh (see Attachments) to $CATALINA_BASE/bin path or create your own setenv.sh that tomcat.sh script will use to source Tomcat and Java environment variables.
You can also use the sample tomcat5.sh or tomcat7.sh template scripts in commons-daemon-1.0.x-native-src/unix/sample folder or create your own script to run Tomcat.
For more information, see http://tomcat.apache.org/tomcat-6.0-doc/setup.html#Unix_daemon.