Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Killing a process in cmd or shell using a script

How to implement using a shell or command line script in Windows that checks for the status of some process, ie. Tomcat server and if it exists, it kills it?

like image 904
Takarakaka Avatar asked Dec 11 '22 21:12

Takarakaka


1 Answers

On window you can make a .bat file with this content:

TASKKILL /F /IM "program_name.exe"

replace program_name with the program you want to kill. Here's a decent article on TASKKILL

Or if it's just tomcat you can run shutdown.bat... if TOMCAT_HOME isn't set just run it from the tomcat home directory.

like image 193
JKirchartz Avatar answered Dec 23 '22 15:12

JKirchartz