Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Shell script to check if Tomcat is running?

Tim Funk

2003-12-01

Replies:

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
-----------------------------

OR

-----------------------------
# Assume glodenfile should be result from url below
rm dest_file.html
wget http://more/cowbell.txt --output-document=dest_file.html
COWBELL=`diff dest_file.html goldenfile.html | wc -l`
if [ $COWBELL == 0 ]; then
 echo "Woohoo - the site is up (and not hacked)";
else
 echo "The downloaded page is diff from the golden file"
fi
-----------------------------


-Tim

Tom Ly wrote:

> I plan on using cron to automatically run a script to check if Tomcat is running. How would I write one?
>
> -Tom



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.