Linux脚本杀死Java进程 [英] linux script to kill java process
本文介绍了Linux脚本杀死Java进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望linux脚本杀死控制台上运行的Java程序.
I want linux script to kill java program running on console.
以下是作为jar运行的进程.
Following is the process running as jar.
[rapp@s1-dlap0 ~]$ ps -ef |grep java
rapp 9473 1 0 15:03 pts/1 00:00:15 java -jar wskInterface-0.0.1-SNAPSHOT-jar-with-dependencies.jar
rapp 10177 8995 0 16:00 pts/1 00:00:00 grep java
[rapp@s1-dlap0 ~]$
推荐答案
您可以像这样简单地使用pkill -f
:
You can simply use pkill -f
like this:
pkill -f 'java -jar'
要杀死运行您特定jar的特定Java进程,请使用基于regex的pkill命令:
To kill a particular java process running your specific jar use this regex based pkill command:
pkill -f 'java.*lnwskInterface'
这篇关于Linux脚本杀死Java进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文