#!/bin/csh -f # tomcat # ------------------------------------------------------------------------------ # Shell script to launch and manage Apache Jakarta Tomcat Web server and # web apps. # ------------------------------------------------------------------------------ # Usage: See Usage section below or run with -h or --help option to see usage. # Assumptions: # Effects: # - Performs operations on the Tomcat server and apps. # Notes: # - Much of the management is done via the Tomcat Manager app via the # URLs documented at: # http://jakarta.apache.org/tomcat/tomcat-5.0-doc/manager-howto.html # Implementation Notes: # Portability Issues: # Revision History: # $Log$ # ------------------------------------------------------------------------------ if ($#argv == 0 || "$1" == "-h" || "$1" == "--help") then echo "Usage: " echo " $0:t start Start Tomcat server" echo " $0:t startdebug Start Tomcat server in debug (JPDA) mode" echo " $0:t stop Stop Tomcat server" echo " $0:t list List deployed and installed apps" echo " $0:t serverinfo List server info (versions, etc.)" echo " $0:t roles List security roles" echo "" echo " $0:t start app Start app at specified context path" echo " $0:t stop app Stop app at specified context path" echo " $0:t reload app Reload app at specified context path" echo " $0:t sessions app List app's session statistics (active sessions, " echo " timeouts, etc.)" echo " $0:t undeploy app Undeploy (and delete, if in webapps) app at path" echo " $0:t deploywar war Deploy app from fully specified war file, using" echo " base of war file name as context path" echo " $0:t deployxml xml Deploy app from fully specified xml file" echo " $0:t deploydir app dir_name" echo " Deploy app at path from fully specified directory" exit 1 endif # Moved to startup files. #setenv CATALINA_HOME /usr/local/tomcat #setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Home #setenv PATH ${PATH}:${JAVA_HOME}/bin # Necessary? # Override the default JAVA_HOME so Tomcat will run a different version. # Use the same version for Tomcat here as for Tomcat on bristle.com. # No. Now using current Java, not forcing to old 1.4.2. # echo "" # beep "Overriding Tomcat's JAVA_HOME!" # setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home # echo "CATALINA_HOME=$CATALINA_HOME" # echo "JAVA_HOME=$JAVA_HOME" # Needed by servlets for JDBC. # Not needed? Done by adding zip file to webapps lib folder or Tomcat lib # folder or something? #setenv CLASSPATH /home/stlukf00/OracleJDBC/classes12_01.zip # Needed by servlets for Xerces XML Parser. # Not needed? Done by adding zip file to webapps lib folder or Tomcat lib # folder or something? #setenv CLASSPATH ${CLASSPATH}:/home/stlukf00/xerces/xerces-1_1_3/xerces.jar # echo "CLASSPATH=`printenv CLASSPATH`" # echo "" if ($#argv == 1) then if ("$1" == "start") then # For now, always start in debug mode. # $CATALINA_HOME/bin/startup.sh $0:q startdebug else if ("$1" == "startdebug") then setenv JPDA_TRANSPORT dt_socket setenv JPDA_ADDRESS 8000 $CATALINA_HOME/bin/catalina.sh jpda start else if ("$1" == "stop") then $CATALINA_HOME/bin/shutdown.sh else if ("$1" == "restart") then $0:q stop sleep 2 $0:q start else if ("$1" == "list") then readurl admin britomcat "http://localhost:8314/manager/$1" else if ("$1" == "serverinfo") then readurl admin britomcat "http://localhost:8314/manager/$1" else if ("$1" == "roles") then readurl admin britomcat "http://localhost:8314/manager/$1" endif else if ($#argv >= 2) then if ("$1" == "start") then readurl admin britomcat "http://localhost:8314/manager/$1?path=/$2" else if ("$1" == "stop") then readurl admin britomcat "http://localhost:8314/manager/$1?path=/$2" else if ("$1" == "reload") then readurl admin britomcat "http://localhost:8314/manager/$1?path=/$2" else if ("$1" == "sessions") then readurl admin britomcat "http://localhost:8314/manager/$1?path=/$2" else if ("$1" == "undeploy") then readurl admin britomcat "http://localhost:8314/manager/$1?path=/$2" else if ("$1" == "deploywar") then readurl admin britomcat "http://localhost:8314/manager/deploy?war=jar:file:/$2!/" else if ("$1" == "deployxml") then readurl admin britomcat "http://localhost:8314/manager/deploy?config=file:/$2" endif else if ($#argv >= 3) then if ("$1" == "deploydir") then readurl admin britomcat "http://localhost:8314/manager/deploy?path=/$2&war=file:/$3" endif endif exit 0