Our company currently runs the Apache Tomcat application server. This server occasionally runs out of memory and requires a restart.
-A linux shell script that will continuously monitor the log file for the tomcat application server.
-If the text OutOfMemory is written to the log file the application server should be shut down.
-The stop and start scripts are already written as init.d start/stop commands.
-After shutting down the application server and waiting 1 minute, the script should check to see if any threads are still running, if they are, the script should kill these threads.
-After all threads have stopped, the script should start the application server again.
-The log file will not be cleared on a restart, so the script should monitor the output file for the OutOfMemory screen to be written to it (perhaps a 'tail -f' ?). The script should obviously not continuously restart just because of an earlier OutOfMemory error for which the sytem already restarted. When the server is restarted, the startup of the server is also logged in the file--so it is possible that the script could simply look for an OutOfMemory string occurring after the startup string.
9 freelancers estão ofertando em média $43 para esse trabalho
I will write a perl script to do this. Shell is ok, but this one will also email you with a short report on the occurance of a restart. Will need ssh access to your server.