Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
edited by

I am interested to know how people usually check if Tomcat is running on the Unix environment or not.

I check the process running status using the below command:

ps -ef | grep java

ps -ef | grep logging

I checked the port number is active

netstat -a | grep 8080

Is there any better way to check that Tomcat is running? The above seems to be the 'hacky' way of checking that Tomcat is running.

1 Answer

0 votes
by (36.8k points)

Why the grep ps, when the pid has been written to a $CATALINA_PID file?

I have the cron'd checker script which sends out the email when tomcat is down:

kill -0 `cat $CATALINA_PID` > /dev/null 2>&1

if [ $? -gt 0 ]

then

    echo "Check tomcat" | mailx -s "Tomcat not running" [email protected]

fi

I guess you could also use the wget to check the health of the tomcat. If you have any diagnostics page with a user load etc, you can fetch it periodically and parse it to determine if anything is wrong.

Come and join Linux training to gain great knowledge. 

Related questions

0 votes
1 answer
asked Nov 18, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
asked Dec 16, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...