8
votes
4answers
3k views

How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?

I'm trying to set up a shell script so that it runs background processes, and when I Ctrlc the shell script, it kills the children, then exits. The best that I've managed to come up with is this. It ...
2
votes
1answer
234 views

Why doesn't an orphan process receive signals?

I have two shell scripts: launch_job.sh and sub_job.sh. If launch_job.sh uses the following method to run sub_job.sh: nohup sub_job.sh & sub_job.sh becomes an orphan, i.e. with PPID 1. I ...
9
votes
1answer
4k views

How to suspend and resume proccesses like bash does

this question is a follow-up to: How to suspend and resume proccesses I have started firefox from a bash session in gnome-terminal. The proccess tree looks like this: $ ps -e -o pid,ppid,cmd -H ...