Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • +1 unfortunately kill(1)'s exit code doesn't distinguish the different error situations (looks like it increments the exit value by one for each process it failed to signal). if the OP doesn't mind writing their own kill(2) wrapper, he could have it exit with different values based on the value of ERRNO after a failed kill(2) call. Commented Jun 15, 2010 at 9:47
  • at the moment I am just doing kill -9 with no check - i just get an error "process doesn't exist" if it doesn't exist which isn't very tidy. How would I test what happened? Commented Jun 15, 2010 at 9:51
  • 15
    Don't carelessly kill -9. That just instantly kills the process giving it no chance to clean up after itself. Instead use kill which is equivalent to kill -15. If that doesn't work, you should find out why, and only as a last resort use kill -9. Commented Jun 15, 2010 at 11:08