How to kill a Child and all its subsequent child process in C
wrote a program that do the following.
1. It fork() and create a child process
2. Child process use execl() command to run a java program..
execl("java -jar st.jar");
3. When i killed the child process programmatically using C system functions it only kills the child process. But the Java process which is created by the child process keeps on running at the backend.
Can you please inform me how can i kill these child of child processes.
when i kill the child process.
I tried Kill commands doesnot work... IS there any command to kill the entire processtree.
You can use "pidof" program
$> kill -9 `pidof -x java`
'-x' option of 'pidof' program is to kill its child process.
Thanks for your reply. I am new to linux programming.
Where i have to define the PARENT PID when i want to kill all its child
Can you please explain a bit more of the command you give me
kill all childs of parent
The syntax of kill command is
As u want to kill ALL children u created by saying execl("java...") after forking.
The Process Group Id, of the "Parent Process" (which forked) and the child
created will same.
so do the following...to kill all process having the SAME PROCESS ID ..should work for u.
|All times are GMT -5. The time now is 08:58 AM.|