Using ps -ef | grep tomcat
I found a tomcat server that is running. I tried kill -9 {id}
but it returns "No such process." What am I doing wrong?
Here's an example:
Admins-MacBook-Pro:test-parent tom.maxwell$ ps -ef | grep tomcat
2043706342 39707 39695 0 3:40PM ttys000 0:00.00 grep tomcat
Admins-MacBook-Pro:test-parent tom.maxwell$ kill -9 39707
-bash: kill: (39707) - No such process
There is no need to know Tomcat's pid (process ID) to kill it. You can use the following command to kill Tomcat:
pkill -9 -f tomcat
ps -ef | grep tomcat | awk '{print $2}' | xargs kill -9
https://gist.github.com/nrshrivatsan/1d2ea4fcdcb9d1857076
Part 1
ps -ef | grep tomcat => Get all processes with tomcat grep
Part 2
Once we have process details, we pipe it into the part 2 of the script
awk '{print $2}' | xargs kill -9 => Get the second column [Process id] and kill them with -9 option
Hope this helps.
Tomcat is not running. Your search is showing you the grep process, which is searching for tomcat. Of course, by the time you see that output, grep is no longer running, so the pid is no longer valid.
just type the below command in terminal
ps -ef |grep 'catalina'
copy the value of process id then type the following command and paste process id
kill -9 processid
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With