Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

May I ask if someone knows how to check if tomcat is running from command line, unix? Thank you very much

share

migration rejected from stackoverflow.com Feb 18 at 21:13

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by kasperd, HBruijn, HopelessN00b Feb 18 at 21:13

This question appears to be off-topic. The users who voted to close gave these specific reasons:

If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

netstat -tulpen shows the current ports your machine is listening on. You could look for the Tomcat port (default 8080)

share

Best way to check if service is running fine is to do a HTTP request to that service. If you just want to see if tomcat is running, just check that the java process is running.

share

I have used below script. This script check tomcat post and process is running up or not,if not then start the tomcat.

############Tomcat Start script######################

if netstat -tulpen | grep 18880   &&  ps -ef | grep tomcat | grep java
then
        echo "Tomcat Running"
else
        echo "Tomcat Stopped"
        /bin/sh /tomcat/bin/startup.sh
fi
share