linux script to kill java process

后端 未结 5 1006
情歌与酒
情歌与酒 2021-01-30 01:04

I want linux script to kill java program running on console.

Following is the process running as jar.

[rapp@s1-dlap0 ~]$ ps -ef |grep java
rapp    9473           


        
5条回答
  •  执笔经年
    2021-01-30 01:43

    If you just want to kill any/all java processes, then all you need is;

    killall java
    

    If, however, you want to kill the wskInterface process in particular, then you're most of the way there, you just need to strip out the process id;

    PID=`ps -ef | grep wskInterface | awk '{ print $2 }'`
    kill -9 $PID
    

    Should do it, there is probably an easier way though...

提交回复
热议问题