Terminating a Bash Script and Its Child Processes in Linux
When a Bash script spawns child processes—say script A starts B, which starts C, which runs rsync—you need a way to terminate the entire process tree cleanly. Simply killing the parent leaves orphaned children running in the background. The most reliable approach uses session IDs (SID). By default, child processes inherit the same session ID…
