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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]