PDA

View Full Version : kill zombie process's


kerry_s
September 25th, 2007, 07:20 AM
just needed a place to put this script so i can find it easier, should i need to.
it kills zombie process's. :)


#!/bin/sh
kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'`

hyper_ch
September 30th, 2007, 04:11 AM
It doesn't kill them all ;(

kerry_s
October 7th, 2007, 06:06 PM
1

G4slight$
May 7th, 2008, 05:40 PM
Ubuntu 8.04 sucks!!! Way too CPU intensive --
and what the hell is a zombie shell doing on install?
BUSTED!!!!!
no real answers on this one - --

hyper_ch
May 8th, 2008, 02:27 AM
G4:
I'm looking forward to your improved Ubuntu release/derivate

GhettoYhetti
May 31st, 2011, 09:52 PM
just needed a place to put this script so i can find it easier, should i need to.
it kills zombie process's. :)


#!/bin/sh
kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'`

Nice . . . . maybe add a couple of echo statement so everyone can see how the scripts works. Just a thought.

You never know when a script will harm rather than hurt.

kerry_s
June 1st, 2011, 12:27 AM
Nice . . . . maybe add a couple of echo statement so everyone can see how the scripts works. Just a thought.

You never know when a script will harm rather than hurt.

you did notice the date? that was from way back 2007.
i don't really come across any zombie process's these days.

leonbravo
June 22nd, 2011, 09:09 PM
you did notice the date? that was from way back 2007.
i don't really come across any zombie process's these days.


Yes, it does.
Ubuntu 11.04 has reported at least 3 zombie processes. Reported in here :
https://bugs.launchpad.net/ubuntu/+source/zeitgeist/+bug/753984
and https://bugs.launchpad.net/ubuntu/+source/zeitgeist/+bug/739780

leonbravo
June 22nd, 2011, 09:20 PM
It seems that the problem with the script is the column in which awk works (I think the only thing it's done with awk is print though)

Coming to my point you can first find the parent of the zombie process. Like this :

ps -fe | grep defunct

that will show you the zombie processes without the header: UID PID PPID C STIME TTY TIME CMD. So that the third column is the parent.

Now you can check the children of the process with:

ps -fe | awk '$3==2372 { print $0}'

Where 2372 was the parent of the zombie process, or change to column $2 to check the parent name.

If you still decide to go on you will have to kill the parent.... (also mix all the command in one line)

GhettoYhetti
July 9th, 2011, 12:27 AM
Didn't mean to stir up trouble. Yes I did notice the date. I just make it a habit of placing echoes in scripts. Especially anything that does kills, removing, etc.

I agree that zombies are a rare thing nowadays, but I came across 2 in 10.10 that I wanted to research different removal methods.

Again I meant nothing negative in my comment. I actually used it.