Question
I want to kill a whole process tree. What is the best way to do this using any common scripting languages? I am looking for a simple solution.
How-To
You don't say if the tree you want to kill is a single process group. (This is often the case if the tree is the result of forking from a server start or a shell command line.) You can discover process groups using GNU ps as follows:
Take below process information as example:
If it is a process group you want to kill, just use the kill(1) command but instead of giving it a process number, give it the negation of the group number. For example to kill every process in group 5086, use kill -TERM -- -5086
沒有留言:
張貼留言