tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Shell script to check if Tomcat is running?
Date Tue, 02 Dec 2003 14:01:38 GMT

Howdy,
You can also always add -DthisIsMyTomcat=true (or any other
distinguishing argument) to the java runtime options, so that you can
grep the ps output for this specific parameter if there are multiple
java processes.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Oscar Carrillo [mailto:tomcat@daydream.stanford.edu]
>Sent: Monday, December 01, 2003 6:42 PM
>To: Tomcat Users List
>Subject: Re: Shell script to check if Tomcat is running?
>
>On Mon, 1 Dec 2003, Tim Funk wrote:
>
>> 2 really simple ways
>>
>>
>> -----------------------------
>> # Assume tomcat is the only java process
>> COWBELL=`ps -ef | grep java| grep -v grep | wc -l`
>> if [ $COWBELL > 0 ]; then
>>    echo "Woohoo - the process is there";
>> fi
>> -----------------------------
>
>This might depend on the shell used, but I think ">" should be "-gt".
>
>Here's another option in case you have java programs running that
aren't
>Tomcat:
>
>#this is all one line
>COWBELL=`ps ax --width=1000 | grep \
>"[o]rg.apache.catalina.startup.Bootstrap \
>start" | awk '{printf $1 " "}' | wc | awk '{print $2}'`
>#end of one line
>if [ $COWBELL -gt 0 ]; then
>    echo "Woohoo - Tomcat is there";
>fi
>
>Cheers,
>Oscar
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message