If you just want to check that the process is running on the machine, here's a sample bash script that I worked up:
#!/bin/bash # This script makes sure certain processes are running and emails support if they aren't # What process to check for PROCESS=tomcat # The command to run COMMAND=$(ps -ef| grep $PROCESS| grep -v grep| wc -l) OUTPUT=$COMMAND # Set the most number of messages we want sent before we stop sending them ATMOST=3 EMAILFILE=/path/to/wherever/scripts/emailsSent.txt # Lets check to see if that file exists and if not, create it if [ ! -f $EMAILFILE ] then # The file does not exist, we better create it echo 0 > $EMAILFILE fi if [ $OUTPUT == 0 ] then # Lets see if we already sent messages NUMBER=$(cat $EMAILFILE) if [ "$NUMBER" != 3 ] then # Go ahead and send the email # The message that will go in the email MESSAGE="The $PROCESS process doesn't seem to be running on $HOSTNAME on $(date +"%x %r %Z") number is $NUMBER" echo $MESSAGE | mail -s "$PROCESS process not running on $HOSTNAME" [EMAIL PROTECTED] # Now increment the number in the EMAILFILE file NEWNUMBER=$(expr $NUMBER + 1) echo $NEWNUMBER > $EMAILFILE fi else # So the process is running, let's make sure the email messages increment number is 0 if [ "$NUMBER" != 0 ] then echo 0 > $EMAILFILE fi fi -----Original Message----- From: Jean-Sebastien Pilon [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 20, 2007 7:17 AM To: Tomcat Users List Subject: RE: Monitoring of Tomcat process You could write a script that wget's the applications home page for a few iterations and that checks that the process is running and restart it if no answer. You could also use nagios with the check_http or with nrpe to check the processes on the app server. See nagios.org on this one, this is quite a bigger thing than the 1st solution if you do not have a monitoring infrastructure with nagios already setup. > -----Original Message----- > From: Virgo Rustianto [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 20, 2007 6:51 AM > To: users@tomcat.apache.org > Subject: Monitoring of Tomcat process > > Hi there, > > Currently I am using Tomcat webserver 4.1.2, does any one know how to > monitoring Tomcat webserver ? The reason is I facing problem > almost everyday > Tomcat was down, currently I don't know how to see does > tomcat running or > down. > Normally after startup I can't see anything except customer > care complaining > our aplication doesn't works then we know tomcat must startup again. > > regards, > Virgo Rustianto > NOTICE: This email contains privileged and confidential information and is intended only for the individual to whom it is addressed. If you are not the named addressee, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this transmission by mistake and delete this communication from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. AVIS: Le présent courriel contient des renseignements de nature privilégiée et confidentielle et n'est destiné qu'à la personne à qui il est adressé. Si vous n'êtes pas le destinataire prévu, vous êtes par les présentes avisés que toute diffusion, distribution ou reproduction de cette communication est strictement interdite. Si vous avez reçu ce courriel par erreur, veuillez en aviser immédiatement l'expéditeur et le supprimer de votre système. Notez que la transmission de courriel ne peut en aucun cas être considéré comme inviolable ou exempt d'erreur puisque les informations qu'il contient pourraient être interceptés, corrompues, perdues, détruites, arrivées en retard ou incomplètes ou contenir un virus. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]