I\'ve got a couple python scripts which I start collectively from a shell script as follows:
#!/bin/bash
python prog1.py &
python prog2.py &
python prog3
Let the bash script catch SIGINT, and have it kill everything in the current process group:
intexit() {
# Kill all subprocesses (all processes in the current process group)
kill -HUP -$$
}
hupexit() {
# HUP'd (probably by intexit)
echo
echo "Interrupted"
exit
}
trap hupexit HUP
trap intexit INT
python prog1.py &
python prog2.py &
python prog3.py &
wait