Stop linux bash script when a background job fails

Viewed 1281

How to be noticed when a background job failed (through any signal SEGV, ABRT, KILL, INT ...), when the job is in the background in a linux bash script.

set -e
foo &
foo_pid=$!
# Do tasks that requires that foo is running
wait $foo_pid

does not work.

2 Answers
Related