Operating System - HP-UX
1819870 Members
2458 Online
109607 Solutions
New Discussion юеВ

Difference between Kill -9 and Kill -15

 
Amith_2
Frequent Advisor

Difference between Kill -9 and Kill -15

We use shut down scripts to kill many of our back ground process during end of business day. In those scripts there are processes which are killed using the value -15. Could anyone please tell me where we use kill -15 and kill -9 and what is the difference between them.
4 REPLIES 4
Henk Geurts
Esteemed Contributor

Re: Difference between Kill -9 and Kill -15

from man kill
9 SIGKILL Kill Forced termination; cannot be trapped
15 SIGTERM Terminate Terminate; can be trapped

regards,
Robert-Jan Goossens
Honored Contributor

Re: Difference between Kill -9 and Kill -15

Cheryl Griffin
Honored Contributor

Re: Difference between Kill -9 and Kill -15

kill -15 allows the process to clean up behind itself. kill -9 is rather brute force and can leave orphaned processes. You're likely to have zombies and defunct (potentially processes owned by init which can only be removed with a reboot ) with kill -9.
"Downtime is a Crime."
Kent Ostby
Honored Contributor

Re: Difference between Kill -9 and Kill -15

Amith --

I personally use just plain kill which does a kill -15 first and then if that doesnt work, I'll use kill -9.

Checking the various shutdown scripts, I find that the only ones using kill -9 are:

/sbin/init.d/SnmpHpunix:
/sbin/init.d/SnmpMaster:
/sbin/init.d/SnmpMib2:
/sbin/init.d/SnmpTrpDst:
/sbin/init.d/emsa:
/sbin/init.d/hparray:
/sbin/init.d/nfs.client:

The others are just using the default "kill -15".

You may have other scripts using kill -9 depending on what you have installed.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"