in reply to Re: ppk
in thread ppk

Never never never use kill -9 on a process, unless that process has resisted prior attempts to die via kill 1, 2, and 15.

Is that general advice for all processes, or is it only for programs that you don't know, that haven't failed to die properly earlier, etc?

I.e. if I have a program whose processes consistently fail to die properly, should I still kill it with 1, 2, and 15 before 9?

/J

Replies are listed 'Best First'.
Re^3: ppk
by merlyn (Sage) on Apr 19, 2005 at 13:59 UTC
    if I have a program whose processes consistently fail to die properly, should I still kill it with 1, 2, and 15 before 9
    If you have a program like that, you should rewrite it! {grin}

    But yes, that's the applicable rule. "kill -9" is always the "last resort" kill.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      Ok. Let me rephrase my question:

      Why?

      (I'm trying to acquire deep technical knowledge here, not cargo cult ;)

      /J

        merlyn may have a different answer, but you should generally try to tell the process to exit nicely first, because it can catch those signals and potentially do useful things on the way out. Processes are not supposed to be able to catch SIGKILL, but are just immediately terminated without the opportunity do to anything else.