Skip to content

Instantly share code, notes, and snippets.

@sric0880
Created April 7, 2022 13:25
Show Gist options
  • Select an option

  • Save sric0880/e9edb0f7bedba092a8a74633306d26e8 to your computer and use it in GitHub Desktop.

Select an option

Save sric0880/e9edb0f7bedba092a8a74633306d26e8 to your computer and use it in GitHub Desktop.
#!/bin/bash
declare -a bgpids
cleanup() {
for pid in ${bgpids[@]}; do
echo kill $pid
kill $pid
done
}
trap "cleanup" SIGINT SIGTERM
echo python start
python test.py & bgpids+=("$!")
for pid in ${bgpids[@]}; do
echo wait $pid
wait $pid
done
echo quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment