Thanks everyone, I simplify the problem with my own request.

In our real env,  only one application deployed in one apache-tomcat server.
 And application will always have its name under opt folder as:

/opt/tomcat/APP_NAME/tomcat-VERSION/webapp/APP_NAME

tomcat version: 5.5, 6.0.18, 6.0.29
Unix env:            Solaris 8/10

I wrote a small script to detect the application status easily.

********************************************************************
$ cat tomcat_status

instance=$1
status=$(/usr/ucb/ps -auwwwx |nawk '$1=$1' OFS="\n" |nawk -F \/ -v
s=$instance '/Dcatalina.home=/&&($4==s)')
if [[ $status == "" ]]; then
  echo "Application $instance is NOT running. "
  exit 0
else
  echo "Application $instance is running. "
  exit 1
fi
********************************************************************

With that, I can detect the exit ID in cronjob, if find any application is
not running, the cronjob will try to start it.

This simple script has fixed my current problem, I will think to write
another script, which will detect the application service status by error
logs.

Happy to share it to everyone, if you have any question regarding this
script,  just ask.

Regards,
Bill

On Fri, Nov 12, 2010 at 4:17 AM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Pid,
>
> On 11/11/2010 3:40 AM, Pid wrote:
> > You could set CATALINA_PID and check that the process ID* contained in
> > the file is active.
>
> That is one way of doing things, but Tomcat might not be "healthy" even
> though the process is running. For instance, I can imagine the following
> scenarios where the process would be running, but not considered "healthy":
>
> 1. Database connection pool is exhausted - possibly permanently
> 2. Request processing thread pool is exhausted - possibly permanently
> 3. JVM has experienced an OOME and parts of Tomcat may be unstable
>
> That last one is very difficult to detect. ;)
>
> In these cases, a Tomcat bounce might be the best action to take.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkzcJUMACgkQ9CaO5/Lv0PBwwgCgky9a2BYJuKrPLUMMSLp9vSZ/
> 0bMAni/grbihuKLgPMG070pKJdBL5/Te
> =3jNj
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to