Recently, several servers were found to have zombie processes (). Run the following command to find out the zombie process ps-A-ostat, ppid, pid, cmd | grep-e '^ [Zz]' command annotation: -parameter A lists all process-o custom output fields. we set the display field to stat (status), ppid (process parent id), pid (
Recently, several servers were found to have zombie processes ().
Run the following command to find the Zombie process:
Ps-A-o stat, ppid, pid, cmd | grep-e '^ [Zz]'
Command annotation:
-Parameter A lists all processes.
-O custom output field we set the display field to stat (status), ppid (process parent id), pid (process id), cmd (command) these four parameters
Because the process in the z or Z status is a zombie process, we use grep to capture the stat status as zZ process.
The running result is as follows:
There are a total of nine zombie processes. we need to take them all out and execute the following command
Kill-9 8310
Then you run the search for dead processes and find that all dead processes are gone.
Supplement:
Recently I encountered another problem. a server generates 100 dead processes, and the parent processes of each dead process are different, that's not exhausting me.
Run a simple command to directly search for dead processes and then kill the parent process.
Ps-A-o stat, ppid, pid, cmd | grep-e '^ [Zz]' | awk '{print $2}' | xargs kill-9