Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 21534 invoked from network); 20 Mar 2011 03:17:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Mar 2011 03:17:54 -0000 Received: (qmail 68435 invoked by uid 500); 20 Mar 2011 03:17:50 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 68351 invoked by uid 500); 20 Mar 2011 03:17:50 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 68342 invoked by uid 99); 20 Mar 2011 03:17:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Mar 2011 03:17:50 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of darryl.lewis@unsw.edu.au designates 149.171.97.17 as permitted sender) Received: from [149.171.97.17] (HELO smtp-dist.unsw.edu.au) (149.171.97.17) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Mar 2011 03:17:40 +0000 Received: from INFPACM001.services.comms.unsw.edu.au (INFPACM001.services.comms.unsw.edu.au [149.171.193.18]) by smtp-dist.unsw.edu.au (8.13.6/8.13.6) with ESMTP id p2K3H1QK002333 for ; Sun, 20 Mar 2011 14:17:01 +1100 (EST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIEAE4OhU2VqzgmgWdsb2JhbACCYKMVFAEBFiYluDOIa4VjBIxn X-IronPort-AV: E=Sophos;i="4.63,213,1299416400"; d="scan'208,217";a="102869122" Received: from infpwex005.ad.unsw.edu.au ([149.171.56.38]) by INFPACM001.services.comms.unsw.edu.au with ESMTP; 20 Mar 2011 13:59:13 +1100 Received: from INFPWEC004.ad.unsw.edu.au ([149.171.135.36]) by infpwex005.ad.unsw.edu.au ([149.171.56.38]) with mapi; Sun, 20 Mar 2011 14:17:00 +1100 From: Darryl Lewis To: Tomcat Users List Date: Sun, 20 Mar 2011 14:16:58 +1100 Subject: Re: How to detect down of tomcat. Thread-Topic: How to detect down of tomcat. Thread-Index: AcvmqBZITt7Pt6FmQAqrqyANDtkG/wAAu2mGAACQZb4= Message-ID: In-Reply-To: Accept-Language: en-US, en-AU Content-Language: en X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-AU Content-Type: multipart/alternative; boundary="_000_C9ABBCDAE2FCdarryllewisunsweduau_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_C9ABBCDAE2FCdarryllewisunsweduau_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Opps...typo #!/bin/sh if [ `ps -ef|grep tomcat|grep -v grep|wc -l` -lt 1 ] then NOW=3D`date` subject=3D"tomcat down $NOW" address=3D"me@domain.com" ps -ef>att.txt mail -s "$subject" "$addr" -- -fno-reply@yourdomain< att.txt fi On 20/03/11 2:00 PM, "Darryl" wrote: Put this in a cronjob to fire every minute #!/bin/sh if [ `ps -ef|grep tomcat|grep -v grep|wc -l` -lt 1 ] then subject=3D`tomcat down; date` address=3D"me@domain.com" ps -ef>att.txt mail -s "$subject" "$addr" -- -fno-reply@yourdomain< att.txt fi Fill in the address with your email address, and you can also pipe an attac= hment For myself, I have scripts that detects when the service is down, sends me = an email, then tries to restart it, then will email if it has managed to re= cover it. If it can't restart it after 5 minutes, then I get an SMS. In the morning, I can quickly see if it failed overnight, and my beauty res= t only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, "Hide" wrote: How to detect down of tomcat. Helo. My environment is tomcat7, java1.6, windows. When process of tomcat terminated abnormally, is there any method or setting that output the abnormal termination to a lo= g file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is g= ood. The motive that wants to know such a thing is because I want to detect down= of tomcat in automatically without human operation. I set a file and keyword in a log monitor tool, and it detects down of tom= cat automatically. Thanks for your advice. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org --_000_C9ABBCDAE2FCdarryllewisunsweduau_--