1753685 Members
5348 Online
108799 Solutions
New Discussion юеВ

a process killing script

 
SOLVED
Go to solution
Phillip Popp
Regular Advisor

a process killing script

Hi,
Really don't know any scripting. I am in the HP 10.2 enviroment. Writing in Ksh shell. I need to find all process that are defunct and delete them with a script I can put on a cron.

Can any one help.

Thanks,

Phil
7 REPLIES 7
Jeff Schussele
Honored Contributor
Solution

Re: a process killing script

Hi Phil,

Well...this may be a headbanger for you.
Defunct processes are also known as zombie processes and as such you need to understand they are *already* dead & can't be killed.

This would only be a problem if the number, mem size or resources these processes hold become constraining.

My 2 cents,
Jeff Schussele
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Dennis Handly
Acclaimed Contributor

Re: a process killing script

You can't kill zombies, you can only kill the zombie master. Since this requires a judgment call, you should do this manually.
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1145648
James R. Ferguson
Acclaimed Contributor

Re: a process killing script

Hi Phillip:

You can find "defunct" processes by running 'ps -ef' and grepping for "" or by running 'UNIX95= ps -o pid,state' and looking for pids with a "Z" state.

That said, trying to kill them isn't going to work. A defunct process is otherwise known as a "zombie". It is already dead, waiting for its parent to reap its termination status before it is removed from the kernel's process table.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: a process killing script

If you have no further questions for this topic you may want to consider closing the thread so everyone knows there is a solution.
http://forums.itrc.hp.com/service/forums/helptips.do?#40
rmueller58
Valued Contributor

Re: a process killing script

ps -ef |grep -v -f /usr/local/bin/patt.1 |grep $1 > temp.1
kill -9 `awk '{print $2}' temp.1`
rm temp.1
Suraj K Sankari
Honored Contributor

Re: a process killing script

Hi,

As I know defunct are called also zombie process which are not able to kill, you can find those process with
# ps ├в aef | grep ├в i defunct

If you see too many defunct process then better reboot the server.

Suraj

Phillip Popp
Regular Advisor

Re: a process killing script

Thanks I have learned a lot