I am running a tomcat server and am attempting to update code on that server. To do this I need to shut down the server reliably in a Windows environment. To the best of my knowledge, the tomcat shutdown.bat script can have issues with runaway threads, and I need this to work even if I accidentally create a thread that will keep the .bat script from working. The approach I have been attempting is to run a NET STOP command with the service name - however I have multiple tomcats running on one machine in some instances (which means multiple services). Is there a way to get the name of the service that is related to the tomcat that is running my code? Are there any other good solutions to my problem that I should look into?
I have many clients and so would prefer a solution that does not involve installing additional software or hard-coding the name of the service.