---

How to propagate a signal to child processes from a Bash script

Suppose we write a script which spawns one or more long running processes; if said script receives a signal such as SIGINT or SIGTERM, we probably want its children to be terminated too (normally when the parent dies, the children survives). We may also want to perform some cleanup tasks before the script itself exits. To be able to reach our goal, we must first learn about process groups and how to execute a process in background.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis