You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by laredotornado <la...@gmail.com> on 2010/07/15 23:25:43 UTC
Script to restart Tomcat
Hi,
I'm using Tomcat 6.0.26 on Mac 10.6.3. I put this script together to try
and restart Tomcat ...
==========Start restart.sh ==============
sh /Library/Tomcat/Home/bin/shutdown.sh
sh /Library/Tomcat/Home/bin/startup.sh
============End restart.sh =============
but what I'm noticing is that sometimes when the script is run, if there was
only one Tomcat process running, there are now two Tomcat processes running,
and I'm wondering if somehow the startup.sh script is being run before
shutdown.sh has completed.
My question is, is this true, or do you have a shell script to restart
Tomcat cleanly?
Thanks, - Dave
--
View this message in context: http://old.nabble.com/Script-to-restart-Tomcat-tp29177874p29177874.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
AW: Script to restart Tomcat
Posted by "Kockert, Timo" <ti...@adesso-mobile.de>.
You don't have to do this yourself. catalina.sh understands the option -force. Before starting the Tomcat, set CATALINA_PID to some file path. The script will store the PID of the Tomcat process in that file. Now you can call "catalina.sh stop 10 -force" which will wait up to 10 seconds for Tomcat to shutdown before it kills the Tomcat process.
Greetings,
Timo
-----Ursprüngliche Nachricht-----
Von: David Fisher [mailto:dfisher@jmlafferty.com]
Gesendet: Freitag, 16. Juli 2010 04:27
An: Tomcat Users List
Betreff: Re: Script to restart Tomcat
I've found that you cannot always rely on the shutdown script closing tomcat quickly. If you have a thread that is not properly managed maybe not at all.
In my restart scripts I find the PID of the tomcat process, run the shutdown script, sleep 10 seconds, test if the PID is still active and if so I kill it. It is then safe to run the startup script.
That ought to work on any type of unix including Mac 10.
Regards,
Dave
On Jul 15, 2010, at 2:47 PM, Jordan Michaels wrote:
> Most restart scripts that I've seen for Tomcat are home-brewed. Just google for Tomcat restart script and I'm sure you'll find something a bit more advanced then what you're using below.
>
> Warm regards,
> Jordan Michaels
> Vivio Technologies
> http://www.viviotech.net/
> Open BlueDragon Steering Committee
> Railo Community Distributions
>
> On 07/15/2010 02:25 PM, laredotornado wrote:
>>
>> Hi,
>>
>> I'm using Tomcat 6.0.26 on Mac 10.6.3. I put this script together to try
>> and restart Tomcat ...
>>
>> ==========Start restart.sh ==============
>> sh /Library/Tomcat/Home/bin/shutdown.sh
>> sh /Library/Tomcat/Home/bin/startup.sh
>> ============End restart.sh =============
>>
>> but what I'm noticing is that sometimes when the script is run, if there was
>> only one Tomcat process running, there are now two Tomcat processes running,
>> and I'm wondering if somehow the startup.sh script is being run before
>> shutdown.sh has completed.
>>
>> My question is, is this true, or do you have a shell script to restart
>> Tomcat cleanly?
>>
>> Thanks, - Dave
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Script to restart Tomcat
Posted by David Fisher <df...@jmlafferty.com>.
I've found that you cannot always rely on the shutdown script closing tomcat quickly. If you have a thread that is not properly managed maybe not at all.
In my restart scripts I find the PID of the tomcat process, run the shutdown script, sleep 10 seconds, test if the PID is still active and if so I kill it. It is then safe to run the startup script.
That ought to work on any type of unix including Mac 10.
Regards,
Dave
On Jul 15, 2010, at 2:47 PM, Jordan Michaels wrote:
> Most restart scripts that I've seen for Tomcat are home-brewed. Just google for Tomcat restart script and I'm sure you'll find something a bit more advanced then what you're using below.
>
> Warm regards,
> Jordan Michaels
> Vivio Technologies
> http://www.viviotech.net/
> Open BlueDragon Steering Committee
> Railo Community Distributions
>
> On 07/15/2010 02:25 PM, laredotornado wrote:
>>
>> Hi,
>>
>> I'm using Tomcat 6.0.26 on Mac 10.6.3. I put this script together to try
>> and restart Tomcat ...
>>
>> ==========Start restart.sh ==============
>> sh /Library/Tomcat/Home/bin/shutdown.sh
>> sh /Library/Tomcat/Home/bin/startup.sh
>> ============End restart.sh =============
>>
>> but what I'm noticing is that sometimes when the script is run, if there was
>> only one Tomcat process running, there are now two Tomcat processes running,
>> and I'm wondering if somehow the startup.sh script is being run before
>> shutdown.sh has completed.
>>
>> My question is, is this true, or do you have a shell script to restart
>> Tomcat cleanly?
>>
>> Thanks, - Dave
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Script to restart Tomcat
Posted by Jordan Michaels <jo...@viviotech.net>.
Most restart scripts that I've seen for Tomcat are home-brewed. Just
google for Tomcat restart script and I'm sure you'll find something a
bit more advanced then what you're using below.
Warm regards,
Jordan Michaels
Vivio Technologies
http://www.viviotech.net/
Open BlueDragon Steering Committee
Railo Community Distributions
On 07/15/2010 02:25 PM, laredotornado wrote:
>
> Hi,
>
> I'm using Tomcat 6.0.26 on Mac 10.6.3. I put this script together to try
> and restart Tomcat ...
>
> ==========Start restart.sh ==============
> sh /Library/Tomcat/Home/bin/shutdown.sh
> sh /Library/Tomcat/Home/bin/startup.sh
> ============End restart.sh =============
>
> but what I'm noticing is that sometimes when the script is run, if there was
> only one Tomcat process running, there are now two Tomcat processes running,
> and I'm wondering if somehow the startup.sh script is being run before
> shutdown.sh has completed.
>
> My question is, is this true, or do you have a shell script to restart
> Tomcat cleanly?
>
> Thanks, - Dave
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org