Created
August 19, 2018 13:45
-
-
Save russellhoff/070e1c1416b98e883160876961f58201 to your computer and use it in GitHub Desktop.
Modify Tomcat's catalina.sh to add "status" option [to be completed]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#rest of the file ... | |
elif [ "$1" = "configtest" ] ; then | |
eval "\"$_RUNJAVA\"" $LOGGING_MANAGER $JAVA_OPTS \ | |
-classpath "\"$CLASSPATH\"" \ | |
-Dcatalina.base="\"$CATALINA_BASE\"" \ | |
-Dcatalina.home="\"$CATALINA_HOME\"" \ | |
-Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \ | |
org.apache.catalina.startup.Bootstrap configtest | |
result=$? | |
if [ $result -ne 0 ]; then | |
echo "Configuration error detected!" | |
fi | |
exit $result | |
elif [ "$1" = "version" ] ; then | |
"$_RUNJAVA" \ | |
-classpath "$CATALINA_HOME/lib/catalina.jar" \ | |
org.apache.catalina.util.ServerInfo | |
elif [ "$1" = "status" ] ; then | |
if [ -n "$CATALINA_PID" ]; then | |
thePid=$( cat $CATALINA_PID ) | |
echo -e "\e[00;32mTomcat is running with pid: $thePid\e[00m" | |
else | |
echo -e "\e[00;31mTomcat is not running\e[00m" | |
return 3 | |
fi | |
else | |
echo "Usage: catalina.sh ( commands ... )" | |
echo "commands:" | |
if $os400; then | |
echo " debug Start Catalina in a debugger (not available on OS400)" | |
echo " debug -security Debug Catalina with a security manager (not available on OS400)" | |
else | |
echo " debug Start Catalina in a debugger" | |
echo " debug -security Debug Catalina with a security manager" | |
fi | |
echo " jpda start Start Catalina under JPDA debugger" | |
echo " run Start Catalina in the current window" | |
echo " run -security Start in the current window with security manager" | |
echo " start Start Catalina in a separate window" | |
echo " start -security Start in a separate window with security manager" | |
echo " stop Stop Catalina, waiting up to 5 seconds for the process to end" | |
echo " stop n Stop Catalina, waiting up to n seconds for the process to end" | |
echo " stop -force Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running" | |
echo " stop n -force Stop Catalina, wait up to n seconds and then use kill -KILL if still running" | |
echo " configtest Run a basic syntax check on server.xml - check exit code for result" | |
echo " version What version of tomcat are you running?" | |
echo "Note: Waiting for the process to end and use of the -force option require that \$CATALINA_PID is defined" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CATALINA_PID="$CATALINA_BASE/tomcat.pid" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment