Re: [OT] Tomcat 7: manager application takes forever to deploy - or not

2011-03-21 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Francis,

On 3/19/2011 5:49 AM, Francis GALIEGUE wrote:
 On Fri, Mar 18, 2011 at 22:45, Christopher Schultz
 ch...@christopherschultz.net wrote:
 [...]

 I'm interested to see how you are able to launch Tomcat and have your
 script continue only after all webapps have been deployed.

 
 This is the code right now:

 [snip]


Why not just run this part after calling catalina.sh?

 MAXITERS=120
 ITERS=0
 
 while true; do
 ITERS=$((ITERS+1))
 if [ $ITERS -gt $MAXITERS ]; then
 echo
 echo 2 BUG: Tomcat not started after
 $MAXITERS seconds!
 exit 1
 fi
 
 perl -ne print if /^$STAMP$/ .. eof() $LOGFILE | \
 egrep -q ^INFO: Server startup in [0-9]+ ms$
 
 RC=$?
 
 if [ $RC = 0 ]; then
 break
 fi
 echo -n .
 sleep 1
 done
 
 echo  Done (in $ITERS seconds)

That's the only part that Tomcat's scripts doesn't handle on its own.

 It is with this script that I noticed the long deploying time of
 /manager. This is the only way I knew of until yesterday, when I
 noticed that the shutdown port only gets open after webapps are
 deployed. I'll switch to this technique (using netstat -ltn|grep -w
 $SHUTDOWN_PORT or something like that) since it is more reliable (and
 faster) than scanning the log file: the server startup message may
 change behind me... Ideally, of course, it'd be very nice if the
 BootStrap class had, said, a fullstart command: I wouldn't need any
 of these ;)

Really? How would you launch a process in the foreground and then have
it go into the background to resume your script?

I'm just trying to save you some of your own time. I'm not going to
argue with you about it :)

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2HX2wACgkQ9CaO5/Lv0PCnFwCeIt9nFI3i/D/DWTzwtKP8WjDJ
/3QAnReSCyf2XnPwZYdVvGCML8L5L7Xx
=CMw1
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Tomcat 7: manager application takes forever to deploy - or not

2011-03-19 Thread Francis GALIEGUE
On Fri, Mar 18, 2011 at 22:45, Christopher Schultz
ch...@christopherschultz.net wrote:
[...]

 I'm interested to see how you are able to launch Tomcat and have your
 script continue only after all webapps have been deployed.


This is the code right now:


if [ $1 = start ]; then
STARTDATE=$(date +%Y%m%d-%H%M)
STAMP START $STARTDATE ===

cat $LOGFILE EOF

$STAMP

EOF

echo -n Starting Tomcat

${JAVACMD} $JAVA_STARTUP_OPTS $JAVA_OPTS \
-classpath $CLASSPATH $TOMCAT_OPTS \
$MAIN_CLASS start  $LOGFILE 21 

echo $!  $CATALINA_PID

MAXITERS=120
ITERS=0

while true; do
ITERS=$((ITERS+1))
if [ $ITERS -gt $MAXITERS ]; then
echo
echo 2 BUG: Tomcat not started after
$MAXITERS seconds!
exit 1
fi

perl -ne print if /^$STAMP$/ .. eof() $LOGFILE | \
egrep -q ^INFO: Server startup in [0-9]+ ms$

RC=$?

if [ $RC = 0 ]; then
break
fi
echo -n .
sleep 1
done

echo  Done (in $ITERS seconds)
[...]


It is with this script that I noticed the long deploying time of
/manager. This is the only way I knew of until yesterday, when I
noticed that the shutdown port only gets open after webapps are
deployed. I'll switch to this technique (using netstat -ltn|grep -w
$SHUTDOWN_PORT or something like that) since it is more reliable (and
faster) than scanning the log file: the server startup message may
change behind me... Ideally, of course, it'd be very nice if the
BootStrap class had, said, a fullstart command: I wouldn't need any
of these ;)

Ultimately, what I really want to do anyway is a startup sequence
which starts Tomcat up only with the manager app, and which deploys
webapps the list of which I store in another place. The deploy command
only returns after the app is fully deployed, which is good (and so
does the undeploy command).

[...]

 Third, what if you want to do SNMP monitoring
 (-Dcom.sun.management.snmp.port=xxx etc etc)? You can't with the
 bundled scripts. Why? If you set JAVA_OPTS appropriately, these
 JAVA_OPTS will also be used for shutdown... Which means you can't
 shutdown at all: EADDRINUSE. Unless you arrange for different
 JAVA_OPTS on startup and shutdown, which I don't need to do with my
 scripts.

 As Chuck suggests, you haven't read the documentation well enough
 because catalina.sh has options to cover your situation described above.


Indeed.

-- 
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
f...@one2team.com
40 avenue Raymond Poincaré
75116 Paris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: [OT] Tomcat 7: manager application takes forever to deploy - or not

2011-03-19 Thread Martin Gainty

MG des réponses sont mises en tête par le MG
__ 
Note de déni et de confidentialité
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Sat, 19 Mar 2011 10:49:34 +0100
 Subject: Re: [OT] Tomcat 7: manager application takes forever to deploy - or 
 not
 From: f...@one2team.com
 To: users@tomcat.apache.org
 
 On Fri, Mar 18, 2011 at 22:45, Christopher Schultz
 ch...@christopherschultz.net wrote:
 [...]
 
  I'm interested to see how you are able to launch Tomcat and have your
  script continue only after all webapps have been deployed.
 
 
 This is the code right now:
 
 
 if [ $1 = start ]; then
 STARTDATE=$(date +%Y%m%d-%H%M)
 STAMP START $STARTDATE ===
 
 cat $LOGFILE EOF
 
 $STAMP
 
 EOF
 
 echo -n Starting Tomcat
 
 ${JAVACMD} $JAVA_STARTUP_OPTS $JAVA_OPTS \
 -classpath $CLASSPATH $TOMCAT_OPTS \
 $MAIN_CLASS start  $LOGFILE 21 
 
 echo $!  $CATALINA_PID
 
 MAXITERS=120
 ITERS=0
 
 while true; do
 ITERS=$((ITERS+1))
 if [ $ITERS -gt $MAXITERS ]; then
 echo
 echo 2 BUG: Tomcat not started after
 $MAXITERS seconds!
 exit 1
 fi
 
 perl -ne print if /^$STAMP$/ .. eof() $LOGFILE | \
 egrep -q ^INFO: Server startup in [0-9]+ ms$
 
 RC=$?
 
 if [ $RC = 0 ]; then
 break
 fi
 echo -n .
 sleep 1
 done
 
 echo  Done (in $ITERS seconds)
 [...]
 
 
 It is with this script that I noticed the long deploying time of
 /manager. This is the only way I knew of until yesterday, when I
 noticed that the shutdown port only gets open after webapps are
 deployed. I'll switch to this technique (using netstat -ltn|grep -w
 $SHUTDOWN_PORT or something like that) since it is more reliable (and
 faster) than scanning the log file: the server startup message may
 change behind me... Ideally, of course, it'd be very nice if the
 BootStrap class had, said, a fullstart command: I wouldn't need any
 of these ;)
 
 Ultimately, what I really want to do anyway is a startup sequence
 which starts Tomcat up only with the manager app, 

MGA default Tomcat installation includes the manager. To add an instance of the
MGManager web application Context to a new host install the
MGmanager.xml context configuration file in the
MG$CATALINA_BASE/conf/[enginename]/[hostname] folder. Here is an example:
MG
Context path=/manager debug=0 privileged=true
 docBase=/usr/local/kinetic/tomcat6/server/webapps/manager
/Context
MG
and which deploys
 webapps the list of which I store in another place. The deploy command
 only returns after the app is fully deployed, which is good (and so
 does the undeploy command).

MGhttp://mojo.codehaus.org/tomcat-maven-plugin/deployment.html
MGtomcat-maven-plugin supports the following configuration attributes
MGconfigurable war file folder called  warSourceDirectory
MGconfigurable location for context.xml called contextFile
MG running embedded tomcat from maven with command 
MGmvn tomcat:run

  Third, what if you want to do SNMP monitoring
  (-Dcom.sun.management.snmp.port=xxx etc etc)? You can't with the
  bundled scripts. Why? If you set JAVA_OPTS appropriately, these
  JAVA_OPTS will also be used for shutdown... Which means you can't
  shutdown at all: EADDRINUSE. Unless you arrange for different
  JAVA_OPTS on startup and shutdown, which I don't need to do with my
  scripts.
 
  As Chuck suggests, you haven't read the documentation well enough
  because catalina.sh has options to cover your situation described above.
 
 
 Indeed.
 
 -- 
 Francis Galiegue
 ONE2TEAM
 Ingénieur système
 Mob : +33 (0) 683 877 875
 Tel : +33 (0) 178 945 552
 f...@one2team.com
 40 avenue Raymond Poincaré
 75116 Paris
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
  

Re: [OT] Tomcat 7: manager application takes forever to deploy - or not

2011-03-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Francis,

On 3/18/2011 6:16 AM, Francis GALIEGUE wrote:
 I build my own CATALINA_HOME, the difference between the bundled
 tar.gz and my home are:
 
 * no i18n jars;
 * only the manager webapp, I don't need the others;
 * changes in logging, I only use the consolehandler;
 * Coyote connector only listens on localhost;
 * I use my own startup scripts, and the java command line is as such:

That's a waste of time for you. Instead, use a CATALINA_BASE with a
custom bin/setenv.sh script to set JAVA_OPTS.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2Dj0wACgkQ9CaO5/Lv0PDTvgCdFk7KbjiU4iPM58QjbK2vU4V3
5KkAn0xUKM/Pm5SRtVoFLFpSL2Oe92EA
=t1iT
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Tomcat 7: manager application takes forever to deploy - or not

2011-03-18 Thread Francis GALIEGUE
On Fri, Mar 18, 2011 at 17:58, Christopher Schultz
ch...@christopherschultz.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Francis,

 On 3/18/2011 6:16 AM, Francis GALIEGUE wrote:
 I build my own CATALINA_HOME, the difference between the bundled
 tar.gz and my home are:

 * no i18n jars;
 * only the manager webapp, I don't need the others;
 * changes in logging, I only use the consolehandler;
 * Coyote connector only listens on localhost;
 * I use my own startup scripts, and the java command line is as such:

 That's a waste of time for you. Instead, use a CATALINA_BASE with a
 custom bin/setenv.sh script to set JAVA_OPTS.


Beauty hides in the eye of the beholder ;)

For one, the default startup and shutdown scripts won't account for
the time taken for the webapps to deploy: when you use startup.sh, the
script terminates after the initial bootstrap is done - I don't want
that. Similarly, the shutdown script won't wait until all webapps are
undeployed and you can end with a stranded JVM trying to shutdown
uncooperative webapps.

Second, I use Linux only and don't need the cygwin/as400/etc specific stuff.

Third, what if you want to do SNMP monitoring
(-Dcom.sun.management.snmp.port=xxx etc etc)? You can't with the
bundled scripts. Why? If you set JAVA_OPTS appropriately, these
JAVA_OPTS will also be used for shutdown... Which means you can't
shutdown at all: EADDRINUSE. Unless you arrange for different
JAVA_OPTS on startup and shutdown, which I don't need to do with my
scripts.

-- 
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
f...@one2team.com
40 avenue Raymond Poincaré
75116 Paris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: [OT] Tomcat 7: manager application takes forever to deploy - or not

2011-03-18 Thread Caldarale, Charles R
 From: Francis GALIEGUE [mailto:f...@one2team.com] 
 Subject: Re: [OT] Tomcat 7: manager application takes forever to deploy - or 
 not

 Third, what if you want to do SNMP monitoring
 (-Dcom.sun.management.snmp.port=xxx etc etc)? You can't with the
 bundled scripts. Why? If you set JAVA_OPTS appropriately, these
 JAVA_OPTS will also be used for shutdown...

Which is what CATALINA_OPTS is for, rather than JAVA_OPTS.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.




Re: [OT] Tomcat 7: manager application takes forever to deploy - or not

2011-03-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Francis,

On 3/18/2011 3:31 PM, Francis GALIEGUE wrote:
 On Fri, Mar 18, 2011 at 17:58, Christopher Schultz
 ch...@christopherschultz.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Francis,

 On 3/18/2011 6:16 AM, Francis GALIEGUE wrote:
 I build my own CATALINA_HOME, the difference between the bundled
 tar.gz and my home are:

 * no i18n jars;
 * only the manager webapp, I don't need the others;
 * changes in logging, I only use the consolehandler;
 * Coyote connector only listens on localhost;
 * I use my own startup scripts, and the java command line is as such:

 That's a waste of time for you. Instead, use a CATALINA_BASE with a
 custom bin/setenv.sh script to set JAVA_OPTS.

 
 Beauty hides in the eye of the beholder ;)

Fair enough.

 For one, the default startup and shutdown scripts won't account for
 the time taken for the webapps to deploy: when you use startup.sh, the
 script terminates after the initial bootstrap is done - I don't want
 that. Similarly, the shutdown script won't wait until all webapps are
 undeployed and you can end with a stranded JVM trying to shutdown
 uncooperative webapps.

I'm interested to see how you are able to launch Tomcat and have your
script continue only after all webapps have been deployed. If you can
already do that, you can just call catalina.sh and perform the same
stalling technique after it completes.

The same can be said for shutdown. Your command line is not
significantly different from that which catalina.sh uses.

 Second, I use Linux only and don't need the cygwin/as400/etc specific stuff.

While that may be true, the startup scripts are often tweaked for
several reasons and you will likely want to get those updates.

 Third, what if you want to do SNMP monitoring
 (-Dcom.sun.management.snmp.port=xxx etc etc)? You can't with the
 bundled scripts. Why? If you set JAVA_OPTS appropriately, these
 JAVA_OPTS will also be used for shutdown... Which means you can't
 shutdown at all: EADDRINUSE. Unless you arrange for different
 JAVA_OPTS on startup and shutdown, which I don't need to do with my
 scripts.

As Chuck suggests, you haven't read the documentation well enough
because catalina.sh has options to cover your situation described above.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2D0m0ACgkQ9CaO5/Lv0PBi1gCfatY5tbMZFGutIERzMyLfvquy
olwAnRXm20wUfnnMsZ03lkro7qXicR9z
=XPYD
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org