i want to set a script which will restart the server automatically.
And i write the following code to setenv.sh
file
JAVA_OPTS="$JAVA_OPTS -XX:OnOutOfMemoryError=/usr/local/apache-tomcat-5.5.30/bin/shutdown.sh;/usr/local/apache-tomcat-5.5.30/bin/startup.sh;"
It not working properly.
I am using tomcat 5
.
To answer your question - I don't think the error handler can run several commands. If you want to do this, then write a small restart script and run your custom script.
However, I would think about this again. Not every OutOfMemoryError means the server should be restarted automatically. You'd better to get a notification and then profile the server to get the cause of the OOME, so you can get rid of it.
P.S Any reason to use the old tomcat 5.5? tomcat 7 is quite mature.