rdhaese
10/3/2017 - 12:43 PM

cmd: Stop tomcat if running

Checks if a tomcat is running (by utilized port!) and shuts it down if necessary. .bat script.

Can also be used to check for other processes that are using a certain port.

netstat -na | find "LISTENING" | find /C /I ":8080" > NUL
if %ERRORLEVEL%==0 goto :running

echo Tomcat is not running
goto :prepare

:running
echo Shutting down tomcat
CALL catalina.bat stop

:prepare
....