Hi, I should document these things better...
Additional clarification interleaved in your email. The environment variables: CATALINA_HOME CATALINA_BASE JAVA_OPTS CATALINA_OPTS CATALINA_PID are all documented fully in RUNNING.TXT included with Tomcat. Normally only CATALINA_HOME, CATALINA_BASE and CATALINA_PID are set prior to calling the start/stop scripts. The others are typically set in the 'setenv.sh' file which is usually in the Tomcat instance's bin directory. In case you're wondering I'm editing this in Outlook Web Access, so the result might not be pretty (apologies). Let me know if you require any further clarification. Thanks, Best Regards, Brett -----Original Message----- From: Dejan Muhamedagic [mailto:deja...@fastmail.fm] Sent: Thu 15/07/2010 17:00 To: General Linux-HA mailing list Subject: Re: [Linux-HA] Tomcat resource agent - PATCH3 - supports multiple tomcat instance configurations Hi, On Wed, Jul 14, 2010 at 05:54:28PM +0100, Brett Delle Grazie wrote: > Hi, > > This patch provides support for multiple instance tomcat > configurations (i.e. where CATALINA_BASE is configured) as > per Tomcat documentation. There are changes in this patch which seem to be unrelated. I'm not a tomcat expert, so I'm not sure. - there's a fix for CATALINA_PID (the old version wouldn't use the default, though that default has never been advertised in the meta-data) That's a direct side-effect of me changing the start/stop operations to using the locally copied version of the parameters rather than their original OCF_RESKEY_xxxx versions. Otherwise defaults are not observed. In particular catalina_base must default to catalina_home if not set. - -Dname=... got moved to CATALINA_OPTS Yes, in Tomcat start/stop script catalina.sh, CATALINA_OPTS is only used during start operation whereas JAVA_OPTS is used during both operations. It belongs in CATALINA_OPTS. Originally it was being set in the start operation so this didn't matter but I was trying to keep things consistent so I set it in the default list and the only place it can safely go is CATALINA_OPTS. I really don't like this solution for a process check, it has the feel of a hack.. we have the PID, why not use that? - there's a new parameter catalina_base: does this one enable multiple instances? Only if its different from catalina_home. To use this, one should read the RUNNING.TXT that comes with Tomcat. Its default should always be catalina_home to preserve existing behaviour - there's a new parameter java_opts: and this one too? Used during both start and stop operations. Used to pass parameters to the JVM running the start/stop operation - typically things like java.awt.headless=true. It was being exported previously but there was no way to set it. That seems like four changes to me. I can't apply the patch as it is without further clarification. And many thanks for sharing the improvements. Cheers, Dejan > Tested with current Tomcat (6.0.28). > > I hope this helps. > > Best Regards, > > Brett > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > --- tomcat 2010-07-14 11:22:57.000000000 +0100 > +++ tomcat.intact 2010-07-14 12:44:46.000000000 +0100 > @@ -29,10 +29,12 @@ > # OCF_RESKEY_tomcat_user - A user name to start a resource. Default is > root > # OCF_RESKEY_statusurl - URL for state confirmation. Default is > http://127.0.0.1:8080 > # OCF_RESKEY_java_home - Home directory of Java. Default is none > +# OCF_RESKEY_java_opts - Options to pass to Java JVM for start and stop. > Default is none > # OCF_RESKEY_catalina_home - Home directory of Tomcat. Default is none > +# OCF_RESKEY_catalina_base - Base directory of Tomcat. Default is none > # OCF_RESKEY_catalina_pid - A PID file name of Tomcat. Default is > OCF_RESKEY_catalina_home/logs/catalina.pid > # OCF_RESKEY_tomcat_start_opts - Start options of Tomcat. Default is none. > -# OCF_RESKEY_catalina_opts - CATALINA_OPTS environment variable. Default > is none. > +# OCF_RESKEY_catalina_opts - Options to pass to Java JVM for start > operation, always adds -Dname=${OCF_RESKEY_tomcat_name}. Default is none. > # OCF_RESKEY_catalina_rotate_log - Control catalina.out logrotation flag. > Default is NO. > # OCF_RESKEY_catalina_rotatetime - catalina.out logrotation time > span(seconds). Default is 86400. > > ############################################################################### > @@ -147,12 +149,13 @@ > >> "$TOMCAT_CONSOLE" 2>&1 & > else > su - -s /bin/sh "$RESOURCE_TOMCAT_USER" \ > - -c "export JAVA_HOME=${OCF_RESKEY_java_home};\ > - export JAVA_OPTS=-Dname=${TOMCAT_NAME};\ > - export > CATALINA_HOME=${OCF_RESKEY_catalina_home};\ > - export CATALINA_PID=${OCF_RESKEY_catalina_pid};\ > - export > CATALINA_OPTS=\"${OCF_RESKEY_catalina_opts}\";\ > - $CATALINA_HOME/bin/catalina.sh start > ${OCF_RESKEY_tomcat_start_opts}" \ > + -c "export JAVA_HOME=${JAVA_HOME};\ > + export JAVA_OPTS=\"${JAVA_OPTS}\";\ > + export CATALINA_HOME=${CATALINA_HOME};\ > + export CATALINA_BASE=${CATALINA_BASE};\ > + export CATALINA_PID=${CATALINA_PID};\ > + export CATALINA_OPTS=\"${CATALINA_OPTS}\";\ > + $CATALINA_HOME/bin/catalina.sh start > ${TOMCAT_START_OPTS}" \ > >> "$TOMCAT_CONSOLE" 2>&1 & > fi > > @@ -182,10 +185,11 @@ > eval $tomcat_stop_cmd >> "$TOMCAT_CONSOLE" 2>&1 > else > su - -s /bin/sh "$RESOURCE_TOMCAT_USER" \ > - -c "export JAVA_HOME=${OCF_RESKEY_java_home};\ > - export JAVA_OPTS=-Dname=${TOMCAT_NAME};\ > - export > CATALINA_HOME=${OCF_RESKEY_catalina_home};\ > - export CATALINA_PID=${OCF_RESKEY_catalina_pid};\ > + -c "export JAVA_HOME=${JAVA_HOME};\ > + export JAVA_OPTS=\"${JAVA_OPTS}\";\ > + export CATALINA_HOME=${CATALINA_HOME};\ > + export CATALINA_BASE=${CATALINA_BASE};\ > + export CATALINA_PID=${CATALINA_PID};\ > $CATALINA_HOME/bin/catalina.sh stop" \ > >> "$TOMCAT_CONSOLE" 2>&1 & > fi > @@ -262,7 +266,7 @@ > > <parameter name="tomcat_name" unique="1" > > <longdesc lang="en"> > -The name of the resource, added as a Java parameter in JAVA_OPTS: > -Dname=<tomcat_name> to Tomcat > +The name of the resource, added as a Java parameter in CATALINA_OPTS: > -Dname=<tomcat_name> to Tomcat > process on start. Used to ensure process is still running and must be > unique amongst all Tomcat > instances in this cluster. > </longdesc> > @@ -318,6 +322,14 @@ > <content type="string" default="" /> > </parameter> > > +<parameter name="java_opts" unique="0"> > +<longdesc lang="en"> > +Java JVM options used on start and stop > +</longdesc> > +<shortdesc>Java options parsed to JVM, used on start and stop</shortdesc> > +<content type="string" default="" /> > +</parameter> > + > <parameter name="catalina_home" unique="1" required="1"> > <longdesc lang="en"> > Home directory of Tomcat > @@ -326,6 +338,14 @@ > <content type="string" default="" /> > </parameter> > > +<parameter name="catalina_base" unique="1"> > +<longdesc lang="en"> > +Instance directory of Tomcat > +</longdesc> > +<shortdesc>Instance directory of Tomcat, defaults to > catalina_home</shortdesc> > +<content type="string" default="" /> > +</parameter> > + > <parameter name="catalina_pid" unique="1"> > <longdesc lang="en"> > A PID file name for Tomcat > @@ -344,9 +364,9 @@ > > <parameter name="catalina_opts" unique="0"> > <longdesc lang="en"> > -Catalina options, applied on start operation only > +Java JVM options used on start only > </longdesc> > -<shortdesc>Catalina options</shortdesc> > +<shortdesc>Java JVM options used on start</shortdesc> > <content type="string" default="" /> > </parameter> > > @@ -399,17 +419,18 @@ > RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}" > > JAVA_HOME="${OCF_RESKEY_java_home}" > -JAVA_OPTS="-Dname=$TOMCAT_NAME" > +JAVA_OPTS="${OCF_RESKEY_java_opts}" > SEARCH_STR="\\""${JAVA_OPTS}" > CATALINA_HOME="${OCF_RESKEY_catalina_home}" > +CATALINA_BASE="${OCF_RESKEY_catalina_base-${OCF_RESKEY_catalina_home}}" > CATALINA_PID="${OCF_RESKEY_catalina_pid-$CATALINA_HOME/logs/catalina.pid}" > > TOMCAT_START_OPTS="${OCF_RESKEY_tomcat_start_opts}" > -CATALINA_OPTS="${OCF_RESKEY_catalina_opts}" > +CATALINA_OPTS="-Dname=$TOMCAT_NAME ${OCF_RESKEY_catalina_opts}" > CATALINA_ROTATE_LOG="${OCF_RESKEY_catalina_rotate_log-NO}" > CATALINA_ROTATETIME="${OCF_RESKEY_catalina_rotatetime-86400}" > > -export JAVA_HOME JAVA_OPTS CATALINA_HOME CATALINA_PID CATALINA_OPTS > +export JAVA_HOME JAVA_OPTS CATALINA_HOME CATALINA_BASE CATALINA_PID > CATALINA_OPTS > > JAVA=${JAVA_HOME}/bin/java > > _______________________________________________ > Linux-HA mailing list > Linux-HA@lists.linux-ha.org > http://lists.linux-ha.org/mailman/listinfo/linux-ha > See also: http://linux-ha.org/ReportingProblems ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems