ensure stop is always called at the end of entry script

interrupts were not properly handled by the entry script, and could leave
containers active. This is fixed by running stop in a cleanup function, called
on exit.
This commit is contained in:
2024-03-08 12:53:35 -08:00
parent 0ef5029931
commit 41a04e5b2d
@@ -2,6 +2,13 @@
LOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
function cleanup {
${LOCATION}/stop
echo "done."
}
trap cleanup EXIT
# start all instances
${LOCATION}/start
@@ -15,6 +22,3 @@ for f in $(find ${LOCATION} -mindepth 2 -maxdepth 3 -name docker-compose.yml); d
done
echo "waiting on processes: ${pids[@]}"
wait -n ${pids[@]} > /dev/null
# cleanup
${LOCATION}/stop