<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Killing zombie process</title> <atom:link href="http://www.cyberciti.biz/tips/killing-zombie-process.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/killing-zombie-process.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Sridhar Gumpula</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-174944</link> <dc:creator>Sridhar Gumpula</dc:creator> <pubDate>Tue, 18 Oct 2011 02:54:33 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-174944</guid> <description># ps -elf &#124; awk &#039;{ print $2 &quot; &quot; $4 }&#039; &#124; grep -w Z
Z 2019
Z 2803
# kill -9 2019
#</description> <content:encoded><![CDATA[<p># ps -elf | awk &#8216;{ print $2 &#8221; &#8221; $4 }&#8217; | grep -w Z<br
/> Z 2019<br
/> Z 2803<br
/> # kill -9 2019<br
/> #</p> ]]></content:encoded> </item> <item><title>By: Sanjaya Srivastava</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-171288</link> <dc:creator>Sanjaya Srivastava</dc:creator> <pubDate>Thu, 12 May 2011 17:54:46 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-171288</guid> <description>Well Solaris9+ offers  preap command to reap zombie processes.</description> <content:encoded><![CDATA[<p>Well Solaris9+ offers  preap command to reap zombie processes.</p> ]]></content:encoded> </item> <item><title>By: hemanth</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-170473</link> <dc:creator>hemanth</dc:creator> <pubDate>Tue, 05 Apr 2011 11:07:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-170473</guid> <description>&lt;strong&gt;ps -el &#124; grep &#039;Z&#039;&lt;/strong&gt;
No no no. &lt;strong&gt; Don&#039;t use kill -9.&lt;/strong&gt;
It doesn&#039;t give the process a chance to cleanly:
1) shut down socket connections
2) clean up temp files
3) inform its children that it is going away
4) reset its terminal characteristics
and so on and so on and so on.</description> <content:encoded><![CDATA[<p><strong>ps -el | grep &#8216;Z&#8217;</strong></p><p>No no no. <strong> Don&#8217;t use kill -9.</strong></p><p>It doesn&#8217;t give the process a chance to cleanly:</p><p>1) shut down socket connections</p><p>2) clean up temp files</p><p>3) inform its children that it is going away</p><p>4) reset its terminal characteristics</p><p>and so on and so on and so on.</p> ]]></content:encoded> </item> <item><title>By: Florian</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-163398</link> <dc:creator>Florian</dc:creator> <pubDate>Tue, 14 Dec 2010 13:03:06 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-163398</guid> <description>hi
A simple work ?
kill -9 $(ps aux &#124; awk &#039;{print $2,$8}&#039; &#124; grep Z &#124; awk &#039;{print $1}&#039;)
King Regard</description> <content:encoded><![CDATA[<p>hi</p><p>A simple work ?<br
/> kill -9 $(ps aux | awk &#8216;{print $2,$8}&#8217; | grep Z | awk &#8216;{print $1}&#8217;)</p><p>King Regard</p> ]]></content:encoded> </item> <item><title>By: lostboy</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-161510</link> <dc:creator>lostboy</dc:creator> <pubDate>Fri, 26 Nov 2010 12:41:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-161510</guid> <description>To Paul
you’re not likely to get the mouse, but you may do extensive damage to everything around you in the process.
if I use kill -9  to erase zombies from servers what kind of  problems  might  I cause ?
can you give me a hint
thanks</description> <content:encoded><![CDATA[<p>To Paul</p><p>you’re not likely to get the mouse, but you may do extensive damage to everything around you in the process.</p><p>if I use kill -9  to erase zombies from servers what kind of  problems  might  I cause ?<br
/> can you give me a hint<br
/> thanks</p> ]]></content:encoded> </item> <item><title>By: Bill</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-159525</link> <dc:creator>Bill</dc:creator> <pubDate>Thu, 09 Sep 2010 16:06:06 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-159525</guid> <description>cI have a windows machine (win2k) that has what I consider to be a zombie process. Here is the deal...
I have a command prompt open, within that command prompt I have an exe running.
When you look at the active program in the windows task manager, it shows the DOS window.
On the desktop, ther is an open DOS window, and you can see it last executed the progam (delay), but has not returned.
If you Right click on the program in task manage, and choose go to process, there is no CMD process, Further more, the program that is running within that environment, is also NOT listed.
I am remote administrating this machine, and have attempted to reboot, but it will not reboot. I have written VB scripts to shutdown and reboot all the OS processes, but still no go.
Call it a zombie, call it a ghost, call it what you will.... It is there and will not go away without a full and complete shutdown of the machine (which I will have to do). But does anybody know 1) how this happens, or 2) how to resolve without a physical warm or cold boot?</description> <content:encoded><![CDATA[<p>cI have a windows machine (win2k) that has what I consider to be a zombie process. Here is the deal&#8230;</p><p>I have a command prompt open, within that command prompt I have an exe running.</p><p>When you look at the active program in the windows task manager, it shows the DOS window.<br
/> On the desktop, ther is an open DOS window, and you can see it last executed the progam (delay), but has not returned.</p><p>If you Right click on the program in task manage, and choose go to process, there is no CMD process, Further more, the program that is running within that environment, is also NOT listed.</p><p>I am remote administrating this machine, and have attempted to reboot, but it will not reboot. I have written VB scripts to shutdown and reboot all the OS processes, but still no go.</p><p>Call it a zombie, call it a ghost, call it what you will&#8230;. It is there and will not go away without a full and complete shutdown of the machine (which I will have to do). But does anybody know 1) how this happens, or 2) how to resolve without a physical warm or cold boot?</p> ]]></content:encoded> </item> <item><title>By: Yo</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-152332</link> <dc:creator>Yo</dc:creator> <pubDate>Thu, 17 Dec 2009 13:40:09 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-152332</guid> <description>Nice comments by Paul and Steveus
I even like a youtube video titled as &quot;How to Kill a Zombie&quot;
Do search and watch it, Its a must lesson for all of the geeks here !!!
Oops I forgot to say - Nice document by Nixcraft and best feature is I can save it as PDF.
Thanks!!</description> <content:encoded><![CDATA[<p>Nice comments by Paul and Steveus<br
/> I even like a youtube video titled as &#8220;How to Kill a Zombie&#8221;<br
/> Do search and watch it, Its a must lesson for all of the geeks here !!!<br
/> Oops I forgot to say &#8211; Nice document by Nixcraft and best feature is I can save it as PDF.<br
/> Thanks!!</p> ]]></content:encoded> </item> <item><title>By: tangbq</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-152203</link> <dc:creator>tangbq</dc:creator> <pubDate>Wed, 09 Dec 2009 06:14:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-152203</guid> <description>ps aux &#124; awk &#039;{ print $8 &quot; &quot; $2 }&#039; &#124; grep &#039;Z&#039;  &#124;awk &#039;{print $2}&#039; &#124;xargs kill -9</description> <content:encoded><![CDATA[<p>ps aux | awk &#8216;{ print $8 &#8221; &#8221; $2 }&#8217; | grep &#8216;Z&#8217;  |awk &#8216;{print $2}&#8217; |xargs kill -9</p> ]]></content:encoded> </item> <item><title>By: Don</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-150102</link> <dc:creator>Don</dc:creator> <pubDate>Thu, 13 Aug 2009 16:55:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-150102</guid> <description>I know this is old but WTH -
I wrote the script above because we had several developers on a group of HPUX boxes testing a complicated MPE ported application. In many situations runaway processes would create zombie children which would alert us to problematic code. This script would tell me what process created them and who the developer was who kicked it off. Very helpful to me, and I thought that someone, somewhere might benefit from it. Since it is still here and ya&#039;ll are finding it when you search for &quot;how to Kill Zombie processes&quot; it looks like maybe I was right :) Maybe someone learned some basic scripting skills too ;) Isn&#039;t that what the internet is for?</description> <content:encoded><![CDATA[<p>I know this is old but WTH -</p><p>I wrote the script above because we had several developers on a group of HPUX boxes testing a complicated MPE ported application. In many situations runaway processes would create zombie children which would alert us to problematic code. This script would tell me what process created them and who the developer was who kicked it off. Very helpful to me, and I thought that someone, somewhere might benefit from it. Since it is still here and ya&#8217;ll are finding it when you search for &#8220;how to Kill Zombie processes&#8221; it looks like maybe I was right :) Maybe someone learned some basic scripting skills too ;) Isn&#8217;t that what the internet is for?</p> ]]></content:encoded> </item> <item><title>By: steveus christ</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-150100</link> <dc:creator>steveus christ</dc:creator> <pubDate>Thu, 13 Aug 2009 16:19:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-150100</guid> <description>if u want to kill a zombie. just shoot it till it stops moving. its that simple. u should probably shoot the forhead. or the noggin. use a machete or a shotgun seem to work well. when the zombie apocolyps comes. set up traps and execute them. at costs dont let ur zombie bite u.</description> <content:encoded><![CDATA[<p>if u want to kill a zombie. just shoot it till it stops moving. its that simple. u should probably shoot the forhead. or the noggin. use a machete or a shotgun seem to work well. when the zombie apocolyps comes. set up traps and execute them. at costs dont let ur zombie bite u.</p> ]]></content:encoded> </item> <item><title>By: Lesh</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-149408</link> <dc:creator>Lesh</dc:creator> <pubDate>Thu, 09 Jul 2009 12:06:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-149408</guid> <description>ps -ef &#124; grep defunct &#124; awk &#039;{ print $3 }&#039; &#124; xargs kill -9</description> <content:encoded><![CDATA[<p>ps -ef | grep defunct | awk &#8216;{ print $3 }&#8217; | xargs kill -9</p> ]]></content:encoded> </item> <item><title>By: Paul</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-148286</link> <dc:creator>Paul</dc:creator> <pubDate>Fri, 24 Apr 2009 16:39:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-148286</guid> <description>First things first, I am amazed at the amount of time so many people have put into dealing with such a non-issue. Zombie processes are dead, they consume nearly zero system resources. The only time you should be concerned is if you have a large number of them and said number is continuing to grow, in which case getting rid of the zombies is not your problem. You need to find out why you have them in the first place. Removing them is like taking a cold tablet, you are deling with the symptom, not the real problem.
That said, you should never, ever be using &#039;kill -9&#039;, that is an absolute last-ditch resort for dealing with a system that is almost non-functional or in some other critical state. Having a few zombie processes tying up nearly no resources at all is not a critical state, and using kill -9 is like chasing a mouse with a heavy hammer; you&#039;re not likely to get the mouse, but you may do extensive damage to everything around you in the process.
So, what to do? find out what is spawning these processes, and why it is not shutting them down when they exit. See if there is a patch that fixes the issue. Make a report to the maintainers of the package. Restart the parent process. Or to reiterate, find out the cause of the problem and fix that.</description> <content:encoded><![CDATA[<p>First things first, I am amazed at the amount of time so many people have put into dealing with such a non-issue. Zombie processes are dead, they consume nearly zero system resources. The only time you should be concerned is if you have a large number of them and said number is continuing to grow, in which case getting rid of the zombies is not your problem. You need to find out why you have them in the first place. Removing them is like taking a cold tablet, you are deling with the symptom, not the real problem.</p><p>That said, you should never, ever be using &#8216;kill -9&#8242;, that is an absolute last-ditch resort for dealing with a system that is almost non-functional or in some other critical state. Having a few zombie processes tying up nearly no resources at all is not a critical state, and using kill -9 is like chasing a mouse with a heavy hammer; you&#8217;re not likely to get the mouse, but you may do extensive damage to everything around you in the process.</p><p>So, what to do? find out what is spawning these processes, and why it is not shutting them down when they exit. See if there is a patch that fixes the issue. Make a report to the maintainers of the package. Restart the parent process. Or to reiterate, find out the cause of the problem and fix that.</p> ]]></content:encoded> </item> <item><title>By: foo</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-147618</link> <dc:creator>foo</dc:creator> <pubDate>Tue, 10 Mar 2009 21:42:02 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-147618</guid> <description>You need to send the parent process a SIGCHLD or kill it
ps -eo pid,ppid,user,args,stat --sort stat &#124; grep Z &#124; awk &#039;{ print $2 }&#039; &#124; sort -u
gives you the parent process id(s)
kill -s SIGCHLD
or
kill
...</description> <content:encoded><![CDATA[<p>You need to send the parent process a SIGCHLD or kill it</p><p>ps -eo pid,ppid,user,args,stat &#8211;sort stat | grep Z | awk &#8216;{ print $2 }&#8217; | sort -u</p><p>gives you the parent process id(s)</p><p>kill -s SIGCHLD<br
/> or<br
/> kill<br
/> &#8230;</p> ]]></content:encoded> </item> <item><title>By: none</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-146992</link> <dc:creator>none</dc:creator> <pubDate>Fri, 30 Jan 2009 14:55:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-146992</guid> <description>I guess the html is stripped, hope at least one works, I mean $NF == defunct between &quot;less than&quot; and &quot;greater than&quot;:
ps ax &#124; awk &#039;{ if ($NF == &quot;&amp;#60defunct&amp;#62&quot;) print $1 }&#039; &#124; xargs kill -9
ps ax &#124; awk &#039;{ if ($NF == &quot;\&quot;) print $1 }&#039; &#124; xargs kill -9</description> <content:encoded><![CDATA[<p>I guess the html is stripped, hope at least one works, I mean $NF == defunct between &#8220;less than&#8221; and &#8220;greater than&#8221;:</p><p>ps ax | awk &#8216;{ if ($NF == &#8220;&amp;#60defunct&amp;#62&#8243;) print $1 }&#8217; | xargs kill -9</p><p>ps ax | awk &#8216;{ if ($NF == &#8220;\&#8221;) print $1 }&#8217; | xargs kill -9</p> ]]></content:encoded> </item> <item><title>By: none</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-146989</link> <dc:creator>none</dc:creator> <pubDate>Fri, 30 Jan 2009 14:50:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-146989</guid> <description>Quick &#039;n dirty hack:
ps ax &#124; awk &#039;{ if ($NF == &quot;&quot;) print $1 }&#039; &#124; xargs kill -9</description> <content:encoded><![CDATA[<p>Quick &#8216;n dirty hack:</p><p>ps ax | awk &#8216;{ if ($NF == &#8220;&#8221;) print $1 }&#8217; | xargs kill -9</p> ]]></content:encoded> </item> <item><title>By: Don</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-144092</link> <dc:creator>Don</dc:creator> <pubDate>Tue, 17 Jun 2008 17:09:05 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-144092</guid> <description>Updated and tested with HP-UX 11i, Solaris 10, Debian, RHEL4 and SUSE 10
&lt;pre&gt;
#!/usr/bin/bash
#
# Zombie Slayer
#
# zombie_slayer [OPTIONS]
#
# -d
#   Just diplay the zombie processes and exit
#
# -h &#124; help
#   Display help
#
# Default is to show processes and the ask what to kill
#
function Z_Display
{
echo &quot;&quot;
echo &quot;PID - PPID - State - User - Proc&quot;
UNIX95= ps -eo pid,ppid,state,user,comm &#124; awk &#039;BEGIN { count=0 } $3 ~ /Z/ { count++; print $1,$2,$3,$4,$5 } END { print &quot;\n&quot; count &quot; Zombie(s) to slay.&quot; }&#039;
echo &quot;&quot;
}
function Z_Kill
{
read -p &quot;Enter PPID to kill or &#039;exit&#039; : &quot; SLAY_PPID
if [ &quot;$SLAY_PPID&quot; = &quot;exit&quot; ] &#124;&#124; [ &quot;$SLAY_PPID&quot; = &quot;&quot; ]
then
exit
fi
ps -p $SLAY_PPID &#124; grep -q $SLAY_PPID
if [ $? -eq 0 ]
then
UNIX95= ps -o pid,user,state,comm -p $SLAY_PPID &#124; \
awk &#039;$1 ~ /^[0-9]*$/ { print &quot;The program &quot; $4 &quot; with PID &quot; $1 &quot; is being run by the user &quot; $2 &quot; and is currently in state &quot; $3 }&#039;
read -p &quot;Are you sure you want to kill PID $SLAY_PPID ? Y&#124;N : &quot; COMMIT_KILL
if [ &quot;$COMMIT_KILL&quot; = &quot;Y&quot; ] &#124;&#124; [ &quot;$COMMIT_KILL&quot; = &quot;y&quot; ]
then
kill -9 $SLAY_PPID
echo &quot;&quot;
read -p &quot;Killed PID $SLAY_PPID. Run again? Y/N : &quot; GO_AGAIN
else
Z_Kill
fi
else
echo &quot;Invalid PID. Try again.&quot;
echo &quot;&quot;
Z_Kill
fi
}
function help
{
echo &quot;Usage: zombie_slayer [-h &#124; help -d]&quot;
echo &quot;-d just display zombie processes and exit&quot;
echo &quot;-h &#124; help : This help&quot;
exit
}
if [ &quot;$1&quot; = &quot;-h&quot; ] &#124;&#124; [ &quot;$1&quot; = &quot;help&quot; ]
then
help
fi
if [ &quot;$1&quot; = &quot;-d&quot; ]
then
Z_Display
else
Z_Display
Z_Kill
fi
if [ &quot;$GO_AGAIN&quot; = &quot;Y&quot; ] &#124;&#124; [ &quot;$GO_AGAIN&quot; = &quot;y&quot; ]
then
Z_Display
Z_Kill
fi
echo &quot;&quot;
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>Updated and tested with HP-UX 11i, Solaris 10, Debian, RHEL4 and SUSE 10</p><pre>
#!/usr/bin/bash
#
# Zombie Slayer
#
# zombie_slayer [OPTIONS]
#
# -d
#   Just diplay the zombie processes and exit
#
# -h | help
#   Display help
#
# Default is to show processes and the ask what to kill
#
function Z_Display
{
    echo ""
    echo "PID - PPID - State - User - Proc"
    UNIX95= ps -eo pid,ppid,state,user,comm | awk 'BEGIN { count=0 } $3 ~ /Z/ { count++; print $1,$2,$3,$4,$5 } END { print "\n" count " Zombie(s) to slay." }'
    echo ""
}
function Z_Kill
{
    read -p "Enter PPID to kill or 'exit' : " SLAY_PPID
    if [ "$SLAY_PPID" = "exit" ] || [ "$SLAY_PPID" = "" ]
    then
        exit
    fi
    ps -p $SLAY_PPID | grep -q $SLAY_PPID
    if [ $? -eq 0 ]
    then
        UNIX95= ps -o pid,user,state,comm -p $SLAY_PPID | \
        awk '$1 ~ /^[0-9]*$/ { print "The program " $4 " with PID " $1 " is being run by the user " $2 " and is currently in state " $3 }'
        read -p "Are you sure you want to kill PID $SLAY_PPID ? Y|N : " COMMIT_KILL
        if [ "$COMMIT_KILL" = "Y" ] || [ "$COMMIT_KILL" = "y" ]
        then
            kill -9 $SLAY_PPID
            echo ""
            read -p "Killed PID $SLAY_PPID. Run again? Y/N : " GO_AGAIN
        else
            Z_Kill
        fi
    else
        echo "Invalid PID. Try again."
        echo ""
        Z_Kill
    fi
}
function help
{
    echo "Usage: zombie_slayer [-h | help -d]"
    echo "-d just display zombie processes and exit"
    echo "-h | help : This help"
    exit
}
if [ "$1" = "-h" ] || [ "$1" = "help" ]
then
    help
fi
if [ "$1" = "-d" ]
then
    Z_Display
else
    Z_Display
    Z_Kill
fi
if [ "$GO_AGAIN" = "Y" ] || [ "$GO_AGAIN" = "y" ]
then
    Z_Display
    Z_Kill
fi
echo ""
</pre>]]></content:encoded> </item> <item><title>By: Don</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-144037</link> <dc:creator>Don</dc:creator> <pubDate>Wed, 11 Jun 2008 20:22:53 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-144037</guid> <description>&lt;pre&gt;
#!/usr/bin/bash
#
# zombie_slayer [OPTIONS]
#
# -d
#   Just display the zombie processes and exit
#
# -h &#124; help
#   Display help
#
# Default is to show processes and the ask what to kill (exits if any errors when killing processes)
#
function Z_Display
{
echo &quot;&quot;
echo &quot;Proc - PID - PPID - State - User&quot;
UNIX95= ps -eo comm,pid,ppid,state,user &#124; awk &#039;$4 ~ /Z/ { print $1,$2,$3,$4,$5 }&#039;
echo &quot;&quot;
}
function Z_Kill
{
read -p &quot;Enter PPID to kill or &#039;exit&#039; : &quot; SLAY_PPID
if [ &quot;$SLAY_PPID&quot; = &quot;exit&quot; ] &#124;&#124; [ &quot;$SLAY_PPID&quot; = &quot;&quot; ]
then
exit
fi
ps -p $SLAY_PPID &#124; grep -q $SLAY_PPID
if [ $? -eq 0 ]
then
UNIX95= ps -o pid,user,state,comm -p $SLAY_PPID &#124; \
awk &#039;$1 ~ /^[0-9]*$/ { print &quot;The program &quot; $4 &quot; with PID &quot; $1 &quot; is being run by the user &quot; $2 &quot; and is currently in state &quot; $3 }&#039;
read -p &quot;Are you sure you want to kill PID $SLAY_PPID ? Y&#124;N : &quot; COMMIT_KILL
if [ &quot;$COMMIT_KILL&quot; = &quot;Y&quot; ] &#124;&#124; [ &quot;$COMMIT_KILL&quot; = &quot;y&quot; ]
then
kill -9 $SLAY_PPID
if [$? -eq 0]
then
echo &quot;&quot;
read -p &quot;Killed PID $SLAY_PPID. Run again? Y/N : &quot; GO_AGAIN
fi
else
Z_Kill
fi
else
echo &quot;Invalid PID. Try again.&quot;
echo &quot;&quot;
Z_Kill
fi
}
function help
{
echo &quot;Usage: zombie_slayer [-h &#124; help -d]&quot;
echo &quot;-d just display zombie processes and exit&quot;
echo &quot;-h &#124; help : This help&quot;
exit
}
if [ &quot;$1&quot; = &quot;-h&quot; ] &#124;&#124; [ &quot;$1&quot; = &quot;help&quot; ]
then
help
fi
if [ &quot;$1&quot; = &quot;-d&quot; ]
then
Z_Display
else
Z_Display
Z_Kill
fi
if [ &quot;$GO_AGAIN&quot; = &quot;Y&quot; ] &#124;&#124; [ &quot;$GO_AGAIN&quot; = &quot;y&quot; ]
then
Z_Display
Z_Kill
fi
echo &quot;&quot;
&lt;/pre&gt;</description> <content:encoded><![CDATA[<pre>
#!/usr/bin/bash
#
# zombie_slayer [OPTIONS]
#
# -d
#   Just display the zombie processes and exit
#
# -h | help
#   Display help
#
# Default is to show processes and the ask what to kill (exits if any errors when killing processes)
#
function Z_Display
{
    echo ""
    echo "Proc - PID - PPID - State - User"
    UNIX95= ps -eo comm,pid,ppid,state,user | awk '$4 ~ /Z/ { print $1,$2,$3,$4,$5 }'
    echo ""
}
function Z_Kill
{
    read -p "Enter PPID to kill or 'exit' : " SLAY_PPID
    if [ "$SLAY_PPID" = "exit" ] || [ "$SLAY_PPID" = "" ]
    then
        exit
    fi
    ps -p $SLAY_PPID | grep -q $SLAY_PPID
    if [ $? -eq 0 ]
    then
        UNIX95= ps -o pid,user,state,comm -p $SLAY_PPID | \
        awk '$1 ~ /^[0-9]*$/ { print "The program " $4 " with PID " $1 " is being run by the user " $2 " and is currently in state " $3 }'
        read -p "Are you sure you want to kill PID $SLAY_PPID ? Y|N : " COMMIT_KILL
        if [ "$COMMIT_KILL" = "Y" ] || [ "$COMMIT_KILL" = "y" ]
        then
            kill -9 $SLAY_PPID
            if [$? -eq 0]
            then
                echo ""
                read -p "Killed PID $SLAY_PPID. Run again? Y/N : " GO_AGAIN
            fi
        else
            Z_Kill
        fi
    else
        echo "Invalid PID. Try again."
        echo ""
        Z_Kill
    fi
}
function help
{
    echo "Usage: zombie_slayer [-h | help -d]"
    echo "-d just display zombie processes and exit"
    echo "-h | help : This help"
    exit
}
if [ "$1" = "-h" ] || [ "$1" = "help" ]
then
    help
fi
if [ "$1" = "-d" ]
then
    Z_Display
else
    Z_Display
    Z_Kill
fi
if [ "$GO_AGAIN" = "Y" ] || [ "$GO_AGAIN" = "y" ]
then
    Z_Display
    Z_Kill
fi
echo ""
</pre>]]></content:encoded> </item> <item><title>By: AYAK</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-142708</link> <dc:creator>AYAK</dc:creator> <pubDate>Wed, 30 Jan 2008 12:26:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-142708</guid> <description>The thread is some thing like background job for the process smiler to project count from 1 till 100 and the main purpose of the project is get each number value.
eg in our daily life is some programs can&#039;t do any thing until it&#039;s main  job done like some sort of Anti Virus&#039;s when you tried to do another job the program dosen&#039;t respond to any command in the main time i&#039;s in the same process but it take her own mem space :D
i hope i was any useful for you :D</description> <content:encoded><![CDATA[<p>The thread is some thing like background job for the process smiler to project count from 1 till 100 and the main purpose of the project is get each number value.<br
/> eg in our daily life is some programs can&#8217;t do any thing until it&#8217;s main  job done like some sort of Anti Virus&#8217;s when you tried to do another job the program dosen&#8217;t respond to any command in the main time i&#8217;s in the same process but it take her own mem space :D<br
/> i hope i was any useful for you :D</p> ]]></content:encoded> </item> <item><title>By: Pratik Kumar Mishra</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-142064</link> <dc:creator>Pratik Kumar Mishra</dc:creator> <pubDate>Wed, 05 Dec 2007 06:36:27 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-142064</guid> <description>thanks.
I Got my ans of zombie Process.</description> <content:encoded><![CDATA[<p>thanks.<br
/> I Got my ans of zombie Process.</p> ]]></content:encoded> </item> <item><title>By: schwarz</title><link>http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-140609</link> <dc:creator>schwarz</dc:creator> <pubDate>Fri, 27 Jul 2007 14:16:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/killing-zombie-process.html#comment-140609</guid> <description>The first script has major issues with it. This is the one that I use
for each in `ps -ef &#124; grep &#039;&#039; &#124; grep -v PID &#124; awk &#039;{ print $3 }&#039;`; do for every in `ps -ef &#124; grep $each &#124; grep -v cron &#124; awk &#039;{ print $2 }&#039;`; do kill -9 $every; done; done</description> <content:encoded><![CDATA[<p>The first script has major issues with it. This is the one that I use</p><p>for each in `ps -ef | grep &#8221; | grep -v PID | awk &#8216;{ print $3 }&#8217;`; do for every in `ps -ef | grep $each | grep -v cron | awk &#8216;{ print $2 }&#8217;`; do kill -9 $every; done; done</p> ]]></content:encoded> </item> </channel> </rss>
