RE: How to detect down of tomcat.
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 -efatt.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
RE: How to detect down of tomcat.
Hi Darryl. I need a script that do the same you mention: 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 recover it. If it can't restart it after 5 minutes, then I get an SMS. Can you share it? Thanks, Jorge. -Mensaje original- De: Darryl Lewis [mailto:darryl.le...@unsw.edu.au] Enviado el: sábado, 19 de marzo de 2011 23:17 Para: Tomcat Users List Asunto: Re: How to detect down of tomcat. Opps...typo #!/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 -efatt.txt mail -s $subject $addr -- -fno-reply@yourdomain att.txt fi On 20/03/11 2:00 PM, Darryl darryl.le...@unsw.edu.au 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
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 -efatt.txt mail -s $subject $addr -- -fno-reply@yourdomain att.txt fi
Re: How to detect down of tomcat.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hide, On 3/19/2011 10:38 PM, Hide wrote: How to detect down of tomcat. Note that the responses you've been getting are only testing for the Tomcat process still running in some way. There are probably a lot of scenarios where you consider Tomcat down yet it is still running. Some that come to mind: 1. Database connection pool has been exhausted so no work can complete 2. Request processors are all tied up waiting on some lock 3. A connector has failed and is no longer accepting connections These are all situations where a Tomcat restart may be in order but the check the process list technique will fail to detect them. We have a status page that checks the health of our server and we use wget in a script to check the data that comes back. Something like that will be more reliable than just checking the OS's process table. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk2I5moACgkQ9CaO5/Lv0PDcQwCgiz/M0xmGzGQ7Dluo5dWpOCRn V3cAniMel30HEFkSCltZx73hPQtYDp6S =D5IC -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
On Sun, Mar 20, 2011 at 05:05, Hide hide3...@ob4.aitai.ne.jp wrote: [...] My explanation seems to have been bad. I explain it a little more. It is a method to output the information of the abnormal termination in catalina.log that I want to know. Would you teach it if you know some method? Not really, no. If, for instance, you don't have a minimal security configuration, you can put in your code, say, System.exit(0), and Tomcat will die without notice. The base scripts output the PID of a running Tomcat instance in a file, what you can do is check for the existence of the PID in this file. All the code is in catalina.sh already - which makes me wonder why isn't there a catalina.sh status option while we are at it? And even though you are running Windows, you should consider using cygwin. I don't know for PowerShell, what I do know though is that Unix shell expertise is far more common, and Unix shell is much more powerful than Windows' batch files anyway. -- Francis Galiegue ONE2TEAM Ingénieur système Mob : +33 (0) 683 877 875 Tel : +33 (0) 178 945 552 f...@one2team.com 40 avenue Raymond Poincaré 75116 Paris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Or write the script in perl. That way, it will be portable between Unix/Linux/Windows and basically whatever. Darryl Lewis wrote: You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
The basic problem with abnormal termination, is that whatever you may think of, may not be called, if the termination is really abnormal. And also : define abnormal. Hide wrote: Hi, Darryl. Thanks for your advice. My explanation seems to have been bad. I explain it a little more. It is a method to output the information of the abnormal termination in catalina.log that I want to know. Would you teach it if you know some method? Thank you. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:17 PM Subject: Re: How to detect down of tomcat. You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
The other problem will be that tomcat is running, but the application is not responding. There may be nothing in the logs for this, and this is one of my most common issues. In this case, I use some custom scripts to simulate a log in and check for an expected string in the return. On 20/03/11 10:11 PM, André Warnier a...@ice-sa.com wrote: The basic problem with abnormal termination, is that whatever you may think of, may not be called, if the termination is really abnormal. And also : define abnormal. Hide wrote: Hi, Darryl. Thanks for your advice. My explanation seems to have been bad. I explain it a little more. It is a method to output the information of the abnormal termination in catalina.log that I want to know. Would you teach it if you know some method? Thank you. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:17 PM Subject: Re: How to detect down of tomcat. You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Right. And many other things like that. Hide, you may save yourself a lot of time (now and in the future), by having a look at something like Nagios : http://www.nagios.org/ Otherwise, there is a big chance that you will spend a lot of time re-inventing what a lot of people have already done before you. Darryl Lewis wrote: The other problem will be that tomcat is running, but the application is not responding. There may be nothing in the logs for this, and this is one of my most common issues. In this case, I use some custom scripts to simulate a log in and check for an expected string in the return. On 20/03/11 10:11 PM, André Warnier a...@ice-sa.com wrote: The basic problem with abnormal termination, is that whatever you may think of, may not be called, if the termination is really abnormal. And also : define abnormal. Hide wrote: Hi, Darryl. Thanks for your advice. My explanation seems to have been bad. I explain it a little more. It is a method to output the information of the abnormal termination in catalina.log that I want to know. Would you teach it if you know some method? Thank you. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:17 PM Subject: Re: How to detect down of tomcat. You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Or you can install http://java-monitor.com It will send you an e-mail or SMS when Tomcat dies. Plus graphs for memory and file descriptors etc Kees Jan On 20 mrt. 2011, at 12:07, André Warnier a...@ice-sa.com wrote: Or write the script in perl. That way, it will be portable between Unix/Linux/Windows and basically whatever. Darryl Lewis wrote: You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Hi, Darryl. I understood that Tomcat cannot output specific words when tomcat terminated abnormally. I will write a servlet that outputs specific words. I will write a script to call it periodically. The script outputs error log when specific words are not output. Thank you very much. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org; Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 8:20 PM Subject: Re: How to detect down of tomcat. The other problem will be that tomcat is running, but the application is not responding. There may be nothing in the logs for this, and this is one of my most common issues. In this case, I use some custom scripts to simulate a log in and check for an expected string in the return. On 20/03/11 10:11 PM, André Warnier a...@ice-sa.com wrote: The basic problem with abnormal termination, is that whatever you may think of, may not be called, if the termination is really abnormal. And also : define abnormal. Hide wrote: Hi, Darryl. Thanks for your advice. My explanation seems to have been bad. I explain it a little more. It is a method to output the information of the abnormal termination in catalina.log that I want to know. Would you teach it if you know some method? Thank you. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:17 PM Subject: Re: How to detect down of tomcat. You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Exactly. And when you will have done that, you will have done exactly what a Nagios plugin would do. http://exchange.nagios.org/directory/Plugins Hide wrote: Hi, Darryl. I understood that Tomcat cannot output specific words when tomcat terminated abnormally. I will write a servlet that outputs specific words. I will write a script to call it periodically. The script outputs error log when specific words are not output. Thank you very much. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org; Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 8:20 PM Subject: Re: How to detect down of tomcat. The other problem will be that tomcat is running, but the application is not responding. There may be nothing in the logs for this, and this is one of my most common issues. In this case, I use some custom scripts to simulate a log in and check for an expected string in the return. On 20/03/11 10:11 PM, André Warnier a...@ice-sa.com wrote: The basic problem with abnormal termination, is that whatever you may think of, may not be called, if the termination is really abnormal. And also : define abnormal. Hide wrote: Hi, Darryl. Thanks for your advice. My explanation seems to have been bad. I explain it a little more. It is a method to output the information of the abnormal termination in catalina.log that I want to know. Would you teach it if you know some method? Thank you. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:17 PM Subject: Re: How to detect down of tomcat. You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
On 20/03/2011 10:22, Francis GALIEGUE wrote: Not really, no. If, for instance, you don't have a minimal security configuration, you can put in your code, say, System.exit(0), and Tomcat will die without notice. Wrong. If you do that you will see a normal shut-down sequence. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Opps...typo #!/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 -efatt.txt mail -s $subject $addr -- -fno-reply@yourdomain att.txt fi On 20/03/11 2:00 PM, Darryl darryl.le...@unsw.edu.au 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: How to detect down of tomcat.
with windoze under cygwin you may want to sub ps -ef with netstat assuming TC port is 8080 if [ `netstat -ab|grep 8080|grep -v grep|wc -l` -lt 1 ] Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: darryl.le...@unsw.edu.au To: users@tomcat.apache.org Date: Sun, 20 Mar 2011 14:00:49 +1100 Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to detect down of tomcat.
Hi, Darryl. Thanks for your advice. My explanation seems to have been bad. I explain it a little more. It is a method to output the information of the abnormal termination in catalina.log that I want to know. Would you teach it if you know some method? Thank you. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:17 PM Subject: Re: How to detect down of tomcat. You could write something similar using windows powershell. Do you have that installed on your server? On 20/03/11 2:14 PM, Hide hide3...@ob4.aitai.ne.jp wrote: Hi, Darryl. Thanks for your advice. Your script looks like very useful. But in my case, tomcat is running on Microsoft Windows. I am looking for a method to detect the down of tomcat by log file. - Original Message - From: Darryl Lewis darryl.le...@unsw.edu.au To: Tomcat Users List users@tomcat.apache.org Sent: Sunday, March 20, 2011 12:00 PM Subject: Re: How to detect down of tomcat. 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=`tomcat down; date` address=m...@domain.com ps -efatt.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 attachment 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 recover 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 rest only gets disturbed in the really bad cases. On 20/03/11 1:38 PM, Hide hide3...@ob4.aitai.ne.jp 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 log file? If there is it, please let me know. tomcat is the premise that is not service of windows, but even service is good. 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 tomcat automatically. Thanks for your advice. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org