HomePage » Tomcat » TomcatJsvc


JSVC

Jsvc uses 3 processes: a launcher process, a controller process and a controlled process. The controlled process is also the main java thread, if the JVM crashes the controller will restart it in the next minute. Jsvc is a daemon process so it should be started as root and the -user parameter allows to downgrade to an unprivilegded user. When the -wait parameter is used, the launcher process waits until the controller says "I am ready", otherwise it returns after creating the controller process.

Start tomcat with jsvc:
#!/bin/bash

export TOMCAT_HOME=/usr/local/tomcat
export JAVA_HOME=/opt/jdk1.6.0_11-64
case "$1" in 
start)
jsvc -user root -home $JAVA_HOME -pidfile $TOMCAT_HOME/logs/tomcat.pid  \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=$TOMCAT_HOME/conf/logging.properties \
-Djava.endorsed.dirs=$TOMCAT_HOME/endorsed \
-classpath :$TOMCAT_HOME/bin/bootstrap.jar \
-Dcatalina.base=$TOMCAT_HOME -Dcatalina.home=$TOMCAT_HOME \
-Djava.io.tmpdir=$TOMCAT_HOME/temp \
org.apache.catalina.startup.Bootstrap start
;;

stop)
jsvc -home $JAVA_HOME -pidfile $TOMCAT_HOME/logs/tomcat.pid \
-stop org.apache.catalina.startup.Bootstrap
;;

esac

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki