On Fri, Jan 11, 2002 at 09:35:10AM -0000, Adrian Flynn wrote:
> What is the correct kill signal to close a process and ALL its child
> processes cleanly? I am trying to stop and restart a shell script which
> pipes serial port data through several text procesing command. THere are 4
> processes in the process table for the script. When I kill -SIGINT, or
> kill -SIGTERM the shell processes, the other child processes remain running.
> Note it is important that all files are properly closed on termination so I
> cannot use SIGKILL.
If you used Perl you'd only have one process to kill :-) (and you'd have
some hope of doing the error checking I mentioned which is conspicuously
lacking in your shell pipe - or if you really don't care then leave error
checking out of the Perl script and use as is.) You could also add a
signal handler to the Perl script so that it trapped ^C and wrote out what
it still had in its buffer - be fun trying to get the shell pipe to do that.
Niall
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!