简体   繁体   English

在 Linux 中杀死 java 进程

[英]kill a java process in Linux

I have a BI application (looker) runs on a linux VM.我有一个在 linux VM 上运行的 BI 应用程序(查看器)。 tobe able to restart the service, I need to clear the existing java process.为了能够重新启动服务,我需要清除现有的 java 进程。 In below screenshot, after run below script, there is a java process, but not showing in the list when I run jps script.在下面的屏幕截图中,运行以下脚本后,有一个 java 进程,但在我运行 jps 脚本时未显示在列表中。 What's the reason?什么原因? and how can I properly terminate this java process?以及如何正确终止此 java 进程?

ps aux | grep java

来自 SSH 的屏幕截图

Have you tried these?你试过这些吗?

killall java 

or或者

kill $(pidof java)

As you can see from your image, the process id is changing each time 9287 / 9304 and represents | grep java正如您从图像中看到的那样,进程 id 每次 9287 / 9304 都会发生变化,并表示| grep java | grep java - and not a java VM! | grep java - 而不是 java 虚拟机!

A common fix is to filter the ps results for not matching | grep -v一个常见的解决方法是过滤不匹配的ps结果| grep -v | grep -v , such as: | grep -v ,如:

ps aux | grep java | grep -v --regexp=grep.\*java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM