Kill a running shell script, and kill all process running within it
3
votes
1
answer
3512
views
I have a shell script running in the background, which runs 5 different jobs.
When I run the shell script all 5 jobs start running in order.
When I kill this shell, whichever process is running, will still continue to run, even though I have killed the shell.
$ bash shell.sh & echo $!
this gives me the PID of the shell, which allows me to kill it later if I wish to do so at some point.
#!/bin/bash
JOB1
JOB2
JOB3
JOB4
JOB5
How can I make the shell kill all process running within, once it has been killed?
Asked by user
(31 rep)
Feb 4, 2016, 08:14 PM
Last activity: Oct 19, 2024, 06:22 PM
Last activity: Oct 19, 2024, 06:22 PM