Thanks a lot Darryl. Jorge.
De: Darryl Lewis [mailto:darryl.le...@unsw.edu.au] Enviado el: martes, 22 de marzo de 2011 4:05 Para: Jorge Infante Osorio; Tomcat Users List Asunto: Re: How to detect down of tomcat. This needs to be run as root Put it in a cron job to fire every minute #!/bin/sh DOWN=0 read DOWN <status.txt if [ $DOWN eq 1 ] then if [ `ps -ef|grep tomcat|grep -v grep|wc -l` -gt 0 ] then NOW=`date` subject="tomcat recovered $NOW" address="m...@domain.com" ps ef|grep tomcat5 >att.txt mail -s "$subject" "$addr" -- -fno-reply@yourdomain< att.txt fi DOWN=0 fi if [ `ps -ef|grep tomcat|grep -v grep|wc -l` -lt 1 ] then NOW=`date` subject="tomcat down $NOW" address="m...@domain.com" ps ef|grep tomcat5 >att.txt mail -s "$subject" "$addr" -- -fno-reply@yourdomain< att.txt fi DOWN=1 service tomcat5 restart fi echo $DOWN >status.txt On 22/03/11 5:54 PM, "Jorge Infante Osorio" <jorg...@uci.cu> wrote: #!/bin/sh if [ `ps -ef|grep tomcat|grep -v grep|wc -l` -lt 1 ] then NOW=`date` subject="tomcat down $NOW" address="m...@domain.com" ps -ef>att.txt mail -s "$subject" "$addr" -- -fno-reply@yourdomain< att.txt fi --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org