tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Carrillo <tom...@daydream.stanford.edu>
Subject Re: Shell script to check if Tomcat is running?
Date Mon, 01 Dec 2003 23:42:15 GMT
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


Mime
View raw message