M
M
Mon4ik2014-04-12 17:24:06
linux
Mon4ik, 2014-04-12 17:24:06

Auto restart apache tomcat on heap space?

What parameter should be set in catalina.sh to automatically restart tomcat at heap space.
I know there is a setting

-XX:OnOutOfMemoryError=\"touch /tmp/tomcat_suicide;kill -9 %p\"
but it just kills the process.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FactorX, 2014-04-23
@Mon4ik

Let him kill.
in cron:
*/1 * * * * ~/tmp/check_tomcat.sh >> ~/tmp/check_tomcat.sh.log 2>&1
cat ~/tmp/check_tomcat.sh
#!/bin/bash
if [ $( ps -ef|grep tomcat|grep java|wc -l ) -eq 0 ]
then
echo "tomcat process not found, try to start"
service tomcat start
else
echo "tomcat process found"
fi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question