Revision: 46588
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 23, 2011 09:35 by digitalego
Initial Code
#!/bin/bash # tomcat version TOMCAT_VERSION="tomcat-7.0.14" CONF="$1" ACTION="$2" if [ -z "$1" -o -z "$2" ]; then echo "usage: run.sh <configuration> [start|stop]" exit -1 fi if [ `whoami` != "tomcat" ]; then echo " # ================================================== " echo " # !!! WARNING !!! " echo " # You are not running under the user 'tomcat' " echo " # " echo " # We're guessing you probably meant to run: " echo " # sudo su -c \"./run.sh $1 $2\" tomcat " echo " # " echo " # This script will assume you meant to run the above " echo " # command and will continue. You may be prompted for " echo " # because of 'su' command rights.... " echo " # ================================================== " sudo su -c "./run.sh $1 $2" tomcat exit -1 fi # dynamically assign: # * shutdown port # * jmx port # * jpda port let SHUTDOWN_PORT=CONF+1 let JMX_PORT=CONF+2 let JPDA_PORT=CONF+3 # standard tomcat environmental options export JRE_HOME=/opt/dev/java export JAVA_HOME=/opt/dev/java export JPDA_ADDRESS=$JPDA_PORT export JPDA_TRANSPORT=dt_socket export CATALINA_BASE="`pwd`/$CONF" export CATALINA_HOME="`pwd`/$TOMCAT_VERSION" export CATALINA_CONF="`pwd`/shared/server.xml" export LOGGING_CONFIG="-Djava.util.logging.config.file=`pwd`/shared/logging.properties" # jmx support turned on export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote" export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.authenticate=true" export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false" export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.access.file=`pwd`/shared/jmxremote.access" export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.password.file=`pwd`/shared/jmxremote.password" export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT" # pass through shutdown and http port to server.xml export JAVA_OPTS="$JAVA_OPTS -Dhttp.port=$CONF -Dshutdown.port=$SHUTDOWN_PORT" exec "$CATALINA_HOME/bin/catalina.sh" jpda "$ACTION" -config $CATALINA_CONF Tomcat 7.0.14 /S
Initial URL
http://terranceasnyder.com/2011/05/tomcat-best-practices/
Initial Description
Initial Title
Tomcat Multi-Instance Startup Script (run.sh)
Initial Tags
Initial Language
Bash