不能只杀死进程的一个线程,如果使用命令“kill -9 threadNo”,就会杀死进程。
Find java process using below
$ ps -fea | grep -i java
Here is the sample output
user 2895 8191 0 09:28 pts/1 00:00:00 grep -i java
user 4610
4607 1 Aug29 ? 01:40:00 /home/user/Software/java-7-sun/bin/java -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx768m -XX:MaxPermSize=256m -jar /home/user/Software/springsource/sts-3.3.0.RELEASE//plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
and then kill the process
$ kill -9 4610
As you want to automate this via Shell, to get pid, further search in the text with your specific java app (probably search location of app)
ps -ef | grep java | grep -v grep
Extract PID portion using SED
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.