You may want to create a launcher function for your calls to gp, and then 
capture the return value with $?. So something like this:

PROC_LIST="xaa xab xac xad xae xaf"
function foo () {
        gp -q < $1 > $1.results
        echo "$1 finished: $?" >> process_log.txt
}
for X in $PROC_LIST; do
        foo $X
done

In the above example, when gp exits the return value is captured and appended 
to process_log.txt. By parameterizing your calls to 'gp' you can add logging or 
pid tracking functionality specific to that one call. You can even create 
temporary pid files for each one that you can then monitor externally.

Adjusting this to use parallel would probably give you a more robust solution.

-Ben


On Sunday, October 6th, 2024 at 6:24 PM, American Citizen 
<[email protected]> wrote:

> To all:
> 
> I have a simple batch file which has 6 CLI commands to it
> 
> gp -q < xaa > xaa.results &
> 
> 
> gp -q < xab > xab.results &
> 
> 
> gp -q < xac > xac.results &
> 
> 
> gp -q < xad > xad.results &
> 
> 
> gp -q < xae > xae.results &
> 
> 
> gp -q < xaf > xaf.results &
> 
> 
> When I do a simple "% bash do-x.sh" which is the bash script, it runs
> normally
> 
> but due to the redirect commands, doing the "ps -fx" will only return
> the gp command (along with all live commands the system is running) but
> I don't know which xaa, or xab, or xac, etc it is associated with.
> 
> Is there some way to do a "ps -fax | grep gp" command which locates
> exactly the pids involved? And can these results be returned as a simple
> ascii file, so I can do future inquiries to determine when the program
> has stopped running?
> 
> The goal here is to determine when all 6 programs running "gp" have
> terminated.
> 
> Randall

Reply via email to