[CentOS] Starting tomcat on bootup

Wed May 3 17:08:57 UTC 2006
Troy Engel <tengel at fluid.com>

Nick wrote:
> Here's the init script we use, if it helps at all:

In enhancement to Nick's script, I've cooked up some tricks you can add 
to it to allow keeping your server.xml and java options in another 
location (i.e. version control). Using Nick's script layout:

server.xml inclusion:

   XMFILE=/some/path/to/server.xml
   ${TOMCAT_START} -config $XMFILE &

catalina options:

   CATALINA_OPTS=""
   while read option && [[ "$option" != end ]]
   do
     CATALINA_OPTS="$CATALINA_OPTS $option"
   done < "/some/path/to/catalina.properties"
   export CATALINA_OPTS

example catalina.properties:

   -Djava.library.path=/opt/lib
   -Djmagick.systemclassloader=no
   -Djava.awt.headless=true

It's also handy to change the default jdk parameters for more efficient 
behaviour:

   JAVA_OPTS="-server -Xms512m -Xmx512m"
   export JAVA_OPTS

If your want to get some good debugging (i.e. looking for a memory leak 
somewhere that's not getting garbage collected), use something like this:

   JAVA_OPTS="-server -Xms512m -Xmx512m -verbose:gc 
-XX:+PrintGCTimeStamps -XX:+PrintGCDetails 
-XX:+PrintTenuringDistribution -Xloggc:/var/tmp/java_gc.log"

hth,
-te

-- 
Troy Engel | Systems Engineer
Fluid, Inc | http://www.fluid.com