From 2287a765cbc8794a4e094e5be0d1e5e7d57fc333 Mon Sep 17 00:00:00 2001 From: Robert Martin-Legene <robert@nic.ar> Date: Sun, 1 Sep 2019 04:40:28 -0300 Subject: [PATCH] wait demasiado temprano --- bin/singlestart.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/singlestart.sh b/bin/singlestart.sh index 3c00a45..9df1b8b 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 )) -- GitLab