Re: Waiting for _any_ background process to terminate.
From:
Alan Mackenzie
Subject:
Re: Waiting for _any_ background process to terminate.
Date:
Mon, 11 Feb 2013 22:08:05 +0000
User-agent:
Mutt/1.5.21 (2010-09-15)
On Mon, Feb 11, 2013 at 02:34:53PM -0500, Greg Wooledge wrote:
> On Mon, Feb 11, 2013 at 06:59:35PM +0000, Alan Mackenzie wrote:
> > From a bash script, I'd like to be able to start several subtasks and
> > react to any one of them completing. I don't think I can do this with
> > the current bash. The `wait' function either waits on a specified subtask
> > to finish, or for _all_ subtasks to finish.
> This is more of a help-bash matter than a bug-bash one.
OK.
> The general approach is these cases is to set up a trap for SIGCHLD.
> > The sort of thing I want to do with this is to perform lots of gzippings
> > in separate tasks, so as to spread them amongst the cores of my 4-core
> > processor, always keeping 4 subtasks on the go at any time.
> Oh, THAT particular problem. See
>http://mywiki.wooledge.org/ProcessManagement#Advanced_questions
Thanks. An interesting page. I'll have to study it.
--
Alan Mackenzie (Nuremberg, Germany).