how to kill stubborn processes
I've used:
Code:
kill -9 1234 I have search the web about this issue numerous times in the past, and I have never found an adequate solution. The only one being to simply reboot the computer. Is there a better way? How would I see what operations are involved in the process and then kill -9 them? |
If -9 won't kill it then it is probably already dead (aka a "zombie process"). The way to get those out of the process table is to kill the parent process that spawned it.
|
@hedron
Just adding, there is a rare level of "stubbornness" a process might turn into: https://en.wikipedia.org/wiki/Sleep_...ruptible_sleep Check the state of the process you want to kill with ps and if you get a Z - it's pretty much zombified, look after its parent. If it's D - well, send kill signals, wait, and if nothing happens use the "three-finger salute". Here you can get an actual process state codes table: https://unix.stackexchange.com/quest...-in-ps-command or directly from the proc man page ( (3) state %c - section) http://man7.org/linux/man-pages/man5/proc.5.html |
kill -9 ( SIGKILL ) is really a last ditch attempt
you should try -2 ( SIGINT ) first ( that is what Ctrl+C sends ) if that fails -15 ( SIGTERM ), that asks the process to terminate as @volkerdi points out, it is could be a zombie https://en.wikipedia.org/wiki/Zombie_process to figure out if it is a zombie, check ( top ) the status column is usually to the left of CPU% , look for Z ( PgDown/PgUp or Down/Up arrow ) As they are undead you cannot kill them, typically they are only around for a short time and are perfectly normal. However, if you find a particular program/script often spawns "long lived" Zombies you should investigate and possibly discontinue use of it in favour of an earlier/later version that does not exhibit such bad behaviour. for the most part they are harmless, as the zombie is not really doing anything ( although they may be hold onto resources ) some more details on signals ( man 7 signal ) SIGHUP ( -1 ) is worth a mention, you can use that to restart a process I must admit, I don't think I've used that in quite a while a daemon is best restarted via init script/service I have found some Python code to behave oddly ( notably git ) where I have had to send SIGINT ( -2 ) SIGTSTP ( -20 ) SIGCONT ( -18 ) for it to exit cleanly but I've not needed that in a long time. Edit Regards "copy operations" is this cp ? If so I would investigate the health of the hard drive. |
All times are GMT -5. The time now is 10:23 PM. |