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

Linux Tux

Nov 23, 2020, 10:00 (0 Talkback[s])
(Other stories by Egidio Docile)

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.

Complete Story

Read Article At