You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nissim Karpenstein <Ni...@HIVE4.com> on 2000/08/23 17:56:32 UTC
Restarting tomcat which is not responding
I need some help debugging a script I wrote which will restart tomcat when
it stops responding. I have a ping servlet (which I found on the JServ
list I think) that returns I AM ALIVE. The script I use is run from cron
like this:
*/5 * * * * /usr/local/tomcat/bin/watchdog.sh
It kills the processes, but they are not restarted...please help...here is
the script:
#!/bin/bash
PROBLEM=""
#check if the production tomcat is running
PINGOK=`wget -q -O - http://theServer/contact/servlet/ping | grep -c "I AM
ALIVE"`
if [ "$PINGOK" -eq 0 ]; then
echo `date`: Production url not responding >>
/usr/local/tomcat/logs/watchdog.log
PROBLEM="true";
fi
#check if the development tomcat is running
PINGOK=`wget -q -O - http://theServer/dev_contact/servlet/ping | grep -c "I
AM ALIVE"`
if [ "$PINGOK" -eq 0 ]; then
echo `date`: Development url not responding >>
/usr/local/tomcat/logs/watchdog.log
PROBLEM="true";
fi
if [ -n "$PROBLEM" ]; then
echo `date`: Watchdog script restarting tomcat >>
/usr/local/tomcat/logs/watchdog.log
kill -9 `ps ax|grep java\ \-Dtomcat|awk '{ print $1 }'`
/usr/local/tomcat/bin/startup.sh
/usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/dev_server.xml
fi
Re: Restarting tomcat which is not responding
Posted by kevin <ke...@netimage.com.tw>.
Maybe the problem is that you are not starting tomcat as a daemon,
the process exists when watchdog.sh finishes.
Try "nohup /usr/local/tomcat/bin/startup.sh"
----- Original Message -----
From: "Nissim Karpenstein" <Ni...@HIVE4.com>
To: <to...@jakarta.apache.org>
Sent: Wednesday, August 23, 2000 11:56 PM
Subject: Restarting tomcat which is not responding
> I need some help debugging a script I wrote which will restart tomcat when
> it stops responding. I have a ping servlet (which I found on the JServ
> list I think) that returns I AM ALIVE. The script I use is run from cron
> like this:
>
> */5 * * * * /usr/local/tomcat/bin/watchdog.sh
>
> It kills the processes, but they are not restarted...please help...here is
> the script:
>
>
> #!/bin/bash
>
> PROBLEM=""
>
> #check if the production tomcat is running
> PINGOK=`wget -q -O - http://theServer/contact/servlet/ping | grep -c "I AM
> ALIVE"`
> if [ "$PINGOK" -eq 0 ]; then
> echo `date`: Production url not responding >>
> /usr/local/tomcat/logs/watchdog.log
> PROBLEM="true";
> fi
>
> #check if the development tomcat is running
> PINGOK=`wget -q -O - http://theServer/dev_contact/servlet/ping | grep -c
"I
> AM ALIVE"`
> if [ "$PINGOK" -eq 0 ]; then
> echo `date`: Development url not responding >>
> /usr/local/tomcat/logs/watchdog.log
> PROBLEM="true";
> fi
>
> if [ -n "$PROBLEM" ]; then
> echo `date`: Watchdog script restarting tomcat >>
> /usr/local/tomcat/logs/watchdog.log
> kill -9 `ps ax|grep java\ \-Dtomcat|awk '{ print $1 }'`
> /usr/local/tomcat/bin/startup.sh
> /usr/local/tomcat/bin/startup.sh -f
/usr/local/tomcat/conf/dev_server.xml
> fi
>
>
Re: Restarting tomcat which is not responding
Posted by Matt Goss <mg...@rtci.com>.
Nissim,
have you tried using the ./shutdown.sh command instead of the kill command?
Matt
Nissim Karpenstein wrote:
> I need some help debugging a script I wrote which will restart tomcat when
> it stops responding. I have a ping servlet (which I found on the JServ
> list I think) that returns I AM ALIVE. The script I use is run from cron
> like this:
>
> */5 * * * * /usr/local/tomcat/bin/watchdog.sh
>
> It kills the processes, but they are not restarted...please help...here is
> the script:
>
> #!/bin/bash
>
> PROBLEM=""
>
> #check if the production tomcat is running
> PINGOK=`wget -q -O - http://theServer/contact/servlet/ping | grep -c "I AM
> ALIVE"`
> if [ "$PINGOK" -eq 0 ]; then
> echo `date`: Production url not responding >>
> /usr/local/tomcat/logs/watchdog.log
> PROBLEM="true";
> fi
>
> #check if the development tomcat is running
> PINGOK=`wget -q -O - http://theServer/dev_contact/servlet/ping | grep -c "I
> AM ALIVE"`
> if [ "$PINGOK" -eq 0 ]; then
> echo `date`: Development url not responding >>
> /usr/local/tomcat/logs/watchdog.log
> PROBLEM="true";
> fi
>
> if [ -n "$PROBLEM" ]; then
> echo `date`: Watchdog script restarting tomcat >>
> /usr/local/tomcat/logs/watchdog.log
> kill -9 `ps ax|grep java\ \-Dtomcat|awk '{ print $1 }'`
> /usr/local/tomcat/bin/startup.sh
> /usr/local/tomcat/bin/startup.sh -f /usr/local/tomcat/conf/dev_server.xml
> fi