Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-20 Thread Brett Delle Grazie
On 19 January 2011 12:42, Dejan Muhamedagic deja...@fastmail.fm wrote:
 Hi,

 On Tue, Jan 18, 2011 at 12:54:50PM -0500, Vadym Chepkov wrote:

 On Jan 18, 2011, at 10:28 AM, Dejan Muhamedagic wrote:

  On Tue, Jan 18, 2011 at 07:58:28AM -0500, Vadym Chepkov wrote:
 
  On Jan 17, 2011, at 5:43 PM, Brett Delle Grazie wrote:
 
  Hi Dejan,
 
  On 17 January 2011 14:54, Dejan Muhamedagic deja...@fastmail.fm wrote:
  Hi Brett,
 
  Long time.
 
  Indeed it is - thank you for the reminder!
 
  This one simply uses here documents for start/stop operations.
 
  Using 'su -'  always makes me uncomfortable, because this
  would invoke so many things intended for login sessions only,
  especially on systems with /etc/profile.d/. Just a thought.
 
  Well, I'd rather live without it, but sometimes it seems
  necessary. I don't know if tomcat is such a beast, but it could
  be.

 definitely not, it was done in the past to put enormous amount of 
 environment variables into .profile of tomcat user
 But catalina.sh has this code for quite awhile now:

 if [ -r $CATALINA_BASE/bin/setenv.sh ]; then
   . $CATALINA_BASE/bin/setenv.sh
 elif [ -r $CATALINA_HOME/bin/setenv.sh ]; then
   . $CATALINA_HOME/bin/setenv.sh
 fi

 so environment can be set in a setenv.sh

 OK. I'd rather leave this to you tomcat experts to figure out
 which is the right way, but let's keep it as it is in order not
 to disturb the existing installations.

setenv.sh usage requires the following to be set:
(a) CATALINA_HOME
(b) CATALINA_BASE (if different from CATALINA_HOME)

Inside setenv.sh you set:
JAVA_OPTS
CATALINA_OPTS
CATALINA_PID
...

However a 'standard' setenv.sh usage will break the resource agent
- why?
Because of the way the resource agent checks to see if the process is alive.
Instead of using the PID file and associated PID test it uses a grep against the
process table for -Dname parameter added to CATALINA_OPTS.

Resulting in... nothing. - because CATALINA_OPTS is usually reset
inside setenv.sh
One can work around this by suggesting users set CATALINA_OPTS in setenv.sh as:
CATALINA_OPTS=${CATALINA_OPTS} new options go here
Which is in fact what I do - and this permits me to use both the
resource agent and
manual start/stop for testing.

Completely redesigning a minimalist tomcat resource agent would
require the following variables:
CATALINA_HOME
CATALINA_BASE (defaulting to CATALINA_HOME)
status_url (optional)

and usage of setenv.sh which _must_ define (for resource agent usage):
CATALINA_PID
(anything else is optional)

In theory everything else could be inferred from either the resource agent
config (think timeouts here)
and/or importing setenv.sh (for PID file location).


 Vadym

 P.S. Is it necessary for ClusterMon ?

 How should I know? I'm just a poor maintainer who knows close to
 nothing about single resource agents.

 Thanks,

 Dejan

 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
 ___
 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


-- 
Best Regards,

Brett Delle Grazie
___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-19 Thread Dejan Muhamedagic
Hi,

On Tue, Jan 18, 2011 at 12:54:50PM -0500, Vadym Chepkov wrote:
 
 On Jan 18, 2011, at 10:28 AM, Dejan Muhamedagic wrote:
 
  On Tue, Jan 18, 2011 at 07:58:28AM -0500, Vadym Chepkov wrote:
  
  On Jan 17, 2011, at 5:43 PM, Brett Delle Grazie wrote:
  
  Hi Dejan,
  
  On 17 January 2011 14:54, Dejan Muhamedagic deja...@fastmail.fm wrote:
  Hi Brett,
  
  Long time.
  
  Indeed it is - thank you for the reminder!
  
  This one simply uses here documents for start/stop operations.
  
  Using 'su -'  always makes me uncomfortable, because this
  would invoke so many things intended for login sessions only, 
  especially on systems with /etc/profile.d/. Just a thought.
  
  Well, I'd rather live without it, but sometimes it seems
  necessary. I don't know if tomcat is such a beast, but it could
  be.
 
 definitely not, it was done in the past to put enormous amount of environment 
 variables into .profile of tomcat user
 But catalina.sh has this code for quite awhile now:
 
 if [ -r $CATALINA_BASE/bin/setenv.sh ]; then
   . $CATALINA_BASE/bin/setenv.sh
 elif [ -r $CATALINA_HOME/bin/setenv.sh ]; then
   . $CATALINA_HOME/bin/setenv.sh
 fi
 
 so environment can be set in a setenv.sh

OK. I'd rather leave this to you tomcat experts to figure out
which is the right way, but let's keep it as it is in order not
to disturb the existing installations.

 Vadym
 
 P.S. Is it necessary for ClusterMon ?

How should I know? I'm just a poor maintainer who knows close to
nothing about single resource agents.

Thanks,

Dejan

 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
___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-18 Thread Brett Delle Grazie
Hi,

On 18 January 2011 12:58, Vadym Chepkov vchep...@gmail.com wrote:

 On Jan 17, 2011, at 5:43 PM, Brett Delle Grazie wrote:

 Hi Dejan,

 On 17 January 2011 14:54, Dejan Muhamedagic deja...@fastmail.fm wrote:
 Hi Brett,

 Long time.

 Indeed it is - thank you for the reminder!

 This one simply uses here documents for start/stop operations.

 Using 'su -'  always makes me uncomfortable, because this would invoke so 
 many things intended for login sessions only,
 especially on systems with /etc/profile.d/. Just a thought.

It was there originally, so I left it there. Isn't it so that process
limits (using ulimit) for number of open files etc. can be set?
Or are they applied irrespective of whether the su is a login or not?

More patches are coming ... in about an hour

Vadym - sorry for the double post to your email.


 Vadym


 __
 This email has been scanned by the MessageLabs Email Security System.
 For more information please visit http://www.messagelabs.com/email
 __




-- 
Best Regards,

Brett Delle Grazie
___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-18 Thread Dejan Muhamedagic
On Tue, Jan 18, 2011 at 07:58:28AM -0500, Vadym Chepkov wrote:
 
 On Jan 17, 2011, at 5:43 PM, Brett Delle Grazie wrote:
 
  Hi Dejan,
  
  On 17 January 2011 14:54, Dejan Muhamedagic deja...@fastmail.fm wrote:
  Hi Brett,
  
  Long time.
  
  Indeed it is - thank you for the reminder!
  
  This one simply uses here documents for start/stop operations.
 
 Using 'su -'  always makes me uncomfortable, because this
 would invoke so many things intended for login sessions only, 
 especially on systems with /etc/profile.d/. Just a thought.

Well, I'd rather live without it, but sometimes it seems
necessary. I don't know if tomcat is such a beast, but it could
be.

Thanks,

Dejan

 
 Vadym
 
 ___
 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
___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-18 Thread Brett Delle Grazie
On 18 January 2011 15:30, Dejan Muhamedagic deja...@fastmail.fm wrote:
...snip...
 More patches are coming ... in about an hour

Patches sent on completely separate thread.
...snip...
-- 
Best Regards,

Brett Delle Grazie
___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-18 Thread Vadym Chepkov

On Jan 18, 2011, at 10:28 AM, Dejan Muhamedagic wrote:

 On Tue, Jan 18, 2011 at 07:58:28AM -0500, Vadym Chepkov wrote:
 
 On Jan 17, 2011, at 5:43 PM, Brett Delle Grazie wrote:
 
 Hi Dejan,
 
 On 17 January 2011 14:54, Dejan Muhamedagic deja...@fastmail.fm wrote:
 Hi Brett,
 
 Long time.
 
 Indeed it is - thank you for the reminder!
 
 This one simply uses here documents for start/stop operations.
 
 Using 'su -'  always makes me uncomfortable, because this
 would invoke so many things intended for login sessions only, 
 especially on systems with /etc/profile.d/. Just a thought.
 
 Well, I'd rather live without it, but sometimes it seems
 necessary. I don't know if tomcat is such a beast, but it could
 be.

definitely not, it was done in the past to put enormous amount of environment 
variables into .profile of tomcat user
But catalina.sh has this code for quite awhile now:

if [ -r $CATALINA_BASE/bin/setenv.sh ]; then
  . $CATALINA_BASE/bin/setenv.sh
elif [ -r $CATALINA_HOME/bin/setenv.sh ]; then
  . $CATALINA_HOME/bin/setenv.sh
fi

so environment can be set in a setenv.sh

Vadym

P.S. Is it necessary for ClusterMon ?

___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-17 Thread Dejan Muhamedagic
Hi Brett,

Long time.

On Thu, Jul 15, 2010 at 06:57:13PM +0100, Brett Delle Grazie wrote:
 
 Hi,
 
 -Original Message-
 From: Dejan Muhamedagic [mailto:deja...@fastmail.fm]
 Sent: Thu 15/07/2010 15:47
 To: General Linux-HA mailing list
 Subject: Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes
  
 Hi,
 
 On Mon, Jul 12, 2010 at 01:03:05PM +0100, Brett Delle Grazie wrote:
  Hi,
  
  Another patch for the Tomcat resource agent.
  
  This patch simply:
  
  1. Removes the 'n' character added after the '\' on the export
  commands - otherwise this causes 'n' not found messages to
  occur in the resource agent log during start and stop
  operations.
 
 It'd be cleaner to feed everything on the stdin to the su command:
 
 catEOF | su - -s /bin/sh $RESOURCE_TOMCAT_USER  $TOMCAT_CONSOLE 21 
 export JAVA_HOME=${OCF_RESKEY_java_home}
 ...
 $CATALINA_HOME/bin/catalina.sh start ${OCF_RESKEY_tomcat_start_opts}
 EOF
 
 If you feel like testing this too ...
 
 BDG: What a good suggestion. Will test and resubmit.
 
  2. Adds a missing background operator () to the stop
  operation. Otherwise the stop operation cannot be monitored by
  the resource agent
 
 This is a different issue. I'll split it off.

Any news? Could you submit new versions if you have them
available.

Cheers,

Dejan

 BDG: Fine, no problem - its a trivial fix.
 
 Thanks,
 
 Dejan
 
  This patch can be applied independently of the documentation
  patch supplied previously.
  
  I hope this helps
 
 
 Thanks,
  
 Best Regards,
  
 Brett
 
 __
 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
___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2011-01-17 Thread Brett Delle Grazie
Hi Dejan,

On 17 January 2011 14:54, Dejan Muhamedagic deja...@fastmail.fm wrote:
 Hi Brett,

 Long time.

Indeed it is - thank you for the reminder!

This one simply uses here documents for start/stop operations.

-- 
Best Regards,

Brett Delle Grazie
From 1c0a2ef05bfbde930962befd99799d4f6a318231 Mon Sep 17 00:00:00 2001
From: Brett Delle Grazie bdellegra...@iee.org
Date: Mon, 17 Jan 2011 22:09:44 +
Subject: [PATCH] Low: tomcat: Use here-documents to simplify start/stop operations

---
 heartbeat/tomcat |   30 +++---
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/heartbeat/tomcat b/heartbeat/tomcat
index 689edc7..671ba82 100755
--- a/heartbeat/tomcat
+++ b/heartbeat/tomcat
@@ -146,14 +146,14 @@ start_tomcat()
 		$CATALINA_HOME/bin/catalina.sh start $TOMCAT_START_OPTS \
 			 $TOMCAT_CONSOLE 21 
 	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} \
-			 $TOMCAT_CONSOLE 21 
+		cat-END_TOMCAT_START | su - -s /bin/sh $RESOURCE_TOMCAT_USER  $TOMCAT_CONSOLE 21 
+			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}
+END_TOMCAT_START
 	fi
 
 	while true; do
@@ -181,13 +181,13 @@ stop_tomcat()
 			 $TOMCAT_CONSOLE 21 
 		eval $tomcat_stop_cmd  $TOMCAT_CONSOLE 21
 	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};\
-$CATALINA_HOME/bin/catalina.sh stop \
-			 $TOMCAT_CONSOLE 21 
+		cat-END_TOMCAT_STOP | su - -s /bin/sh $RESOURCE_TOMCAT_USER  $TOMCAT_CONSOLE 21 
+			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}
+			$CATALINA_HOME/bin/catalina.sh stop
+END_TOMCAT_STOP
 	fi
 
 	lapse_sec=0
-- 
1.7.1

___
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

Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2010-07-15 Thread Dejan Muhamedagic
Hi,

On Mon, Jul 12, 2010 at 01:03:05PM +0100, Brett Delle Grazie wrote:
 Hi,
 
 Another patch for the Tomcat resource agent.
 
 This patch simply:
 
 1. Removes the 'n' character added after the '\' on the export
 commands - otherwise this causes 'n' not found messages to
 occur in the resource agent log during start and stop
 operations.

It'd be cleaner to feed everything on the stdin to the su command:

catEOF | su - -s /bin/sh $RESOURCE_TOMCAT_USER  $TOMCAT_CONSOLE 21 
export JAVA_HOME=${OCF_RESKEY_java_home}
...
$CATALINA_HOME/bin/catalina.sh start ${OCF_RESKEY_tomcat_start_opts}
EOF

If you feel like testing this too ...

 2. Adds a missing background operator () to the stop
 operation. Otherwise the stop operation cannot be monitored by
 the resource agent

This is a different issue. I'll split it off.

Thanks,

Dejan

 This patch can be applied independently of the documentation
 patch supplied previously.
 
 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 
 __


 ___
 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

___
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


Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2010-07-15 Thread Brett Delle Grazie

Hi,

-Original Message-
From: Dejan Muhamedagic [mailto:deja...@fastmail.fm]
Sent: Thu 15/07/2010 15:47
To: General Linux-HA mailing list
Subject: Re: [Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes
 
Hi,

On Mon, Jul 12, 2010 at 01:03:05PM +0100, Brett Delle Grazie wrote:
 Hi,
 
 Another patch for the Tomcat resource agent.
 
 This patch simply:
 
 1. Removes the 'n' character added after the '\' on the export
 commands - otherwise this causes 'n' not found messages to
 occur in the resource agent log during start and stop
 operations.

It'd be cleaner to feed everything on the stdin to the su command:

catEOF | su - -s /bin/sh $RESOURCE_TOMCAT_USER  $TOMCAT_CONSOLE 21 
export JAVA_HOME=${OCF_RESKEY_java_home}
...
$CATALINA_HOME/bin/catalina.sh start ${OCF_RESKEY_tomcat_start_opts}
EOF

If you feel like testing this too ...

BDG: What a good suggestion. Will test and resubmit.

 2. Adds a missing background operator () to the stop
 operation. Otherwise the stop operation cannot be monitored by
 the resource agent

This is a different issue. I'll split it off.

BDG: Fine, no problem - its a trivial fix.

Thanks,

Dejan

 This patch can be applied independently of the documentation
 patch supplied previously.
 
 I hope this helps


Thanks,
 
Best Regards,
 
Brett

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__winmail.dat___
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

[Linux-HA] Tomcat resource agent - PATCH2 - minor script fixes

2010-07-12 Thread Brett Delle Grazie
Hi,

Another patch for the Tomcat resource agent.

This patch simply:

1. Removes the 'n' character added after the '\' on the export commands - 
otherwise this causes 'n' not found messages to occur
in the resource agent log during start and stop operations.

2. Adds a missing background operator () to the stop operation. Otherwise the 
stop operation cannot be monitored by the resource agent

This patch can be applied independently of the documentation patch supplied 
previously.

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-minor-script-fixes.patch.2
Description: tomcat-minor-script-fixes.patch.2
___
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