Tomcat verbiage:停止与杀戮

时间:2012-02-03 20:03:34

标签: java tomcat process

停止”Tomcat之间有什么区别(在Tomcat术语中),只是杀死了进程?

如果Tomcat的pid为500,那么有什么区别:

  

kill -9 500

  

服务tomcat stop

??提前谢谢!

2 个答案:

答案 0 :(得分:5)

kill = bam!它死了。

停止=让它优雅地结束。任何正在运行的应用程序都可以运行它们出现的任何代码。服务器实例iself将优雅地释放资源。

答案 1 :(得分:0)

不完全是您的问题的答案,但以下是我日常使用的简单shell脚本来杀死我的tomcat进程:

ps -ef | grep tomcat | awk '{print $2}' | xargs kill -9

https://gist.github.com/nrshrivatsan/1d2ea4fcdcb9d1857076

第1部分

ps -ef | grep  tomcat  => Get all processes with tomcat grep

第2部分

获得流程详细信息后,我们将其输入到脚本的第2部分

awk '{print $2}' | xargs kill -9 => Get the second column [Process id] and kill them with -9 option

希望这有帮助。

此致

Shrivats。