I am making a shell script to restart tomcat after a crash. Interestingly, I need to process this message in my script "The Tomcat servlet engine is not running, but the pid file exists." what does this message mean? Should I consider this as an error message that obliges me to restart Tomcat?
My script looks like this:
#!/bin/bash
SERVICE=/etc/init.d/tomcat7
STOPPED_MESSAGE=" * Tomcat servlet container is not running."
PID_FILE_MESSAGE=" * Tomcat servlet engine is not running, but pid file exists."
if [ "`$SERVICE status`" == "$STOPPED_MESSAGE" ];
then
{
$SERVICE start
}
else
if [ "`$SERVICE status`" == "$PID_FILE_MESSAGE" ];
then
{
$SERVICE restart
}
fi
fi
source
share