How to know the gradle process has ended?

I want to get the gradle running process where I can come to know that gradle task has ended.
I am executing gradle tasks parallel in my machines like following.

in Windows,
start gradlew runSuite1 -i --rerun-tasks
start gradlew runSuite1 -i --rerun-tasks
in Mac,
./gradlew runSuite1 -i --rerun-tasks &
./gradlew runSuite2 -i --rerun-tasks &

It will trigger all gradle operations in parallel.

I want to perform one operation once all this gradle tasks are ended.

How to know these gradle running process using java or anything ?

Thanks in advance

It can be done using ‘wait processID’ in shell script .

./gradlew runSuite1 -i --rerun-tasks &
pids[0]=$!

./gradlew runSuite2 -i --rerun-tasks &
pids[1]=$!

for pid in ${pids[*]}; do
    wait $pid
done

REF : https://stackoverflow.com/questions/59249604/how-to-know-the-gradle-process-has-ended/59271939#59271939