Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Nov 2006 13:21:00 +0300
From:      "Andrew Pantyukhin" <infofarmer@FreeBSD.org>
To:        nicky <nicky@valuecare.nl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Parallel shell scripts.
Message-ID:  <cb5206420611080221n3fde2772h3569a8ce8f9920dc@mail.gmail.com>
In-Reply-To: <4551AC4A.2000108@valuecare.nl>
References:  <4551AC4A.2000108@valuecare.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/8/06, nicky <nicky@valuecare.nl> wrote:
> I have to start 2 processes in the background (running in parallel),
> capture their return codes and after all 4 have completed successfully i
> want to continue with the main script.

What do you need their return codes for? If you
only want to display them, something like this
might help:

(/bin/proc1;echo "Proc 1 exited with status $?) &
(/bin/proc2;echo "Proc 2 exited with status $?) &
wait

In general, retrieving exit statuses of multiple
general is not trivial. I.e. you need some kind of
IPC for that, at least store statuses in some tmp
files and read it back from the main process.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cb5206420611080221n3fde2772h3569a8ce8f9920dc>