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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
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 5112, usekill -TERM -- -5112.