Re: How to kill child process running in background



Hi Narasimha,

first of all, if your code is not confidential or anything like that, then
please include it here, or alternatively using a paste site such as
http://pastie.org/ or http://paste.debian.net/ (the latter is useful for other
things beside Debian) or maybe something like http://bitbucket.net/ (or
http://github.com/ , whose underlying version control system is somewhat
harder to use for many beginners.).

On Friday 11 Mar 2011 14:02:59 Narasimha Madineedi wrote:
Hi,

I have 2 shell scripts which runs parallely.
And each script runs 2 child processes simultaniously one after the
another. i have given timeout to run 8hrs for each shell script.
if it exceeds time limit it has to kill the child processes of the process
which exceeds time limit but its killing all the child processes of the
other script also.


Well, I have not done a lot of multi-processing (in UNIX or alternatively in
cygwin, I presume) in shell, and it seems to be very painful (as most any
moderately "serious" programming is in shell.). I would really suggest you
port your script to Perl or a similar language, which allow for more robust
programming.

If you are interested, there are some tutorials on various UNIX system
paradigms here:

http://users.actcom.co.il/~choo/lupg/

They are written in C, but should be easy to translate to Perl with some help
from http://perldoc.perl.org/perlipc.html [PerlIPC] I have not read most of
them, but I can attest for the author's competency and knowledge. The
canonical reference about UNIX fundamentals is considered "Advanced
Programming in the UNIX Environment" (or "APUE" or sometimes "Stevens'" for
short):

* http://www.apuebook.com/

* http://www.amazon.com/dp/0201433079

* http://en.wikipedia.org/wiki/W._Richard_Stevens

I should note that I have only really started reading it now, and it's a large
book which is very condensed.

Good luck!

Regards,

Shlomi Fish

[PerlIPC] - one note about PerlIPC is that the style of most of its code is
archaic and exhibits many "Ancient Perl" paradigms. Last time I asked the
perl5-porters which ones should be fixed it started an entire "colour of the
bikeshed" (see http://en.wikipedia.org/wiki/Parkinson%27s_Law_of_Triviality )
argument about whether or not the perl code in the perl*.pod should be
"modernised" so to speak.

--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
My Public Domain Photos - http://www.flickr.com/photos/shlomif/

There is no IGLU Cabal. The problem of founding an IGLU Cabal has been proven,
in a surprise move, to be equivalent to the question of existence of God,
fully-tolerant religions and NP-complete oracles. -- Omer Zak

Please reply to list if it's a mailing list post - http://shlom.in/reply .
.