How do I kill this tomcat process in Terminal?

后端 未结 14 1582
渐次进展
渐次进展 2021-01-30 01:23

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?

14条回答
  •  面向向阳花
    2021-01-30 02:11

    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.

提交回复
热议问题