Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

killing zombie process through crontab

Status
Not open for further replies.

kat115

Programmer
Feb 6, 2004
57
FR
can i get rid of zombie process by putting this command in crontab :

kill -9 `ps -ef | grep defunct | awk '{print $2}'`

or maybe

kill -9 `ps -ef | grep -v grep | grep defunct | awk '{print $2}'`

?
any better idea?
thanx a lot
 
Zombies should die off quickly. If they are sticking around, there is a problem and you should troubleshoot the problem instead of treating the symptom.
 
Not all defunct processes can be killed using the method you are using.

There are 2 different kinds of zombie processes and depending on the owner of the process it may not be able to be "killed."

There is one trick you can try that may have more effect than just a kill -9, which is:

kill -6 -<PGID>
 
The problem is that users just close their xwindows sessions without disconnecting properly. And when they do so, a zombie process appears.
I can see IBM telling me that I should ask WRQ (reflexionX) to solve the problem, and I already know they won't help..

kat
 
Why do you want to get rid of them - they're not using cpu are they :)

Alex
 

Lots of processes slows down the process reprioritising in the scheduler.

Cheers
 
Ah I see - fortunately I've never come across this problem before :)

Alex
 
I know your problem.
I got the same with exceed.
This is my way to work with:
stopsrc -s dtsrc
startsrc -s dtsrc

But this kill all your xterms.
You have to do it by script during the night.
 
not better in principle but more efficient than your initial method:

ps -ef | awk '/[d]efunct/{system("kill -9 "$2}'

spawns fewer processes.

IBM Certified -- AIX 4.3 Obfuscation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top