diff --git a/bin/singlestart.sh b/bin/singlestart.sh index 3c00a45dd346d32044dc5fe46399ae464717b4e4..9df1b8b040e40746870e9813657deb8f3d0d434e 100755 --- a/bin/singlestart.sh +++ b/bin/singlestart.sh @@ -19,9 +19,12 @@ function reaper() do kill -0 $pid 2>/dev/null && continue rc=wait $pid - echo "${PIDIDX[$pid]} (pid $pid) has exited with value $rc" - unset aaa[$pid] + echo "*** ${PIDIDX[$pid]} (pid $pid) has exited with value $rc" + unset PIDIDX[$pid] done + # kill all - an extra kill doesn't hurt. I hope. + kill ${!PIDIDX[*]} 2>/dev/null || true + max=30 } if [ "$VIRTUALIZATION" = "DOCKER" ] @@ -86,13 +89,8 @@ echo "*** Starting monitor.js" monitor.js > ${LOGPIPE} 2>&1 & PIDIDX[$!]="monitor.js" -wait -n # if one dies -sleep 2 # give log.sh time to work on the data written, before we kill it. -echo "*** Some process ended, so will shut down other processes too." > ${LOGPIPE} -kill ${!PIDIDX[*]} 2>/dev/null || true # kill all -# wait for them all to end -max=30 -while [ -n "${!PIDIDX[*]}" -a $max -gt 0 ] +max=-1 +while [ -n "${!PIDIDX[*]}" -a $max -eq 0 ] do sleep 1 max=$(( $max - 1 ))