Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-19-2004, 04:38 PM   #1
LQ Newbie
Registered: Aug 2004
Posts: 1

Rep: Reputation: 0
When I kill parent process, child isn't killed

I written a C program that forks and execs a shell script. The shell script then invokes the JVM to execute a Java program. This all works ok.

My C program (the parent) gets the pid of the shell script (the child) as the return value from the fork call. When I try to kill the script and the jvm by sending the SIGTERM signal to the child process, the child process (the script) dies, but the JVM continues to run. I use kill(child_pid, SIGTERM) in my C code, where child_pid was returned to my by fork, as mentioned above.

When I do a ps from the command prompt, I can see the script and JVM processes. When I check the status of these processes in /proc, the JVM is indeed a child of the script process.

Is it because my script process does not propagate the SIGTERM signal to its child (the JVM)?

Do I need to do something more to my script to propagate this signal?

Here is my script (note cvm is the jvm on my system, I use J2ME, MyProg is my Java program):

/usr/local/java/bin/cvm MyProg



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to kill a Child and all its subsequent child process in C shayer009 Programming 3 12-04-2007 12:40 AM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 01:19 PM
parent and child processes skora Programming 5 11-02-2003 10:41 AM
about parent and child process winwar Solaris / OpenSolaris 3 07-23-2003 06:07 AM
child and parent process error jdevanand Programming 1 04-29-2002 08:13 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration