Killing a process on Linux

server01:/# ps -ax | grep java

Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

 7342 pts/3    Z      0:00 [java] <defunct>

 7404 pts/3    S+     0:00 grep java


server01:/# kill 7342

server01:/# ps -ax | grep java

Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

 7342 pts/3    Z      0:00 [java] <defunct>

 7406 pts/3    S+     0:00 grep java


server01:/# 

In the above example, I use the ps command to find out the pid of the java process, which in this case is 7342.

Then I killed this process using the kill command. But this is not killed, because the ps command shows a java process with pid 7342.

Should I use the else command to kill the process and why kill is not able to kill the process

Thanx

+3
source share
7 answers

Linux supports BSD style keys for a command ps(without a leading -... dash / hyphen). If you are shipping hypen, a version of GNU coreutils ps(one that is standard on major Linux distributions) will try to interpret the switches as SysV compatible. This is the source of your error.

BSD- -o, , PID .

. , . - , , . , "" . wait(), , , ( ) init. init Linux ( UNIX) ().

, UNIX/Linux, ""... , - ( , init).

ServerFault

+5

ps aux

kill -1 PID_NUMBER

, ,

kill -9 PID_NUMBER

, -9 :

+5

kill -9 , .....

+4

. , , . , kill -9, , . Defunct ( ) , .

: , kill -9 <pid>.

+1

kill -9 $(pgrep -f keyword).

pid (), "KEYWORD";

+1
kill $(pgrep [search pattern])

, . , root, .

0

The java process has become a zombie process. Try sending a signal SIGCHLDto the parent process using killto tell the parent process to use the zombie child process. Otherwise, as @Martin mentioned, you can kill the parent or kill -9the zombie process.

0
source

Source: https://habr.com/ru/post/1752261/


All Articles