Skip to content

Instantly share code, notes, and snippets.

@mihansweatpants
Created May 31, 2019 12:24
Show Gist options
  • Select an option

  • Save mihansweatpants/bf2756cdf0b93ff45d19c5facb422984 to your computer and use it in GitHub Desktop.

Select an option

Save mihansweatpants/bf2756cdf0b93ff45d19c5facb422984 to your computer and use it in GitHub Desktop.

Run multiple tasks from one script and kill them all on ctrl+c

Took my dumbass two hours to figure this out

#!/bin/bash

trap "exit" INT TERM ERR
trap "kill -s KILL 0" EXIT

./startProcess1 &
./startProcess2 &
./startProcess3 &

wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment