Stop execution of python script when parent Bash shell script is killed

Posted by jrdioko on Stack Overflow See other posts from Stack Overflow or by jrdioko
Published on 2010-04-16T18:49:35Z Indexed on 2010/04/16 18:53 UTC
Read the original article Hit count: 332

Filed under:
|
|

I'm working on a Bash shell script that runs several Python scripts like so:

cd ${SCRIPT_PATH}
python -u ${SCRIPT_NAME} ${SCRIPT_ARGS} >> $JOBLOG 2>&1

At one point, I killed the shell script (using kill PID), but the Python script continued running, even after the script terminated. I thought these would die as soon as the main script died. What am I misunderstanding about Bash scripting, and what can I do to get the functionality I'm looking for? Thanks in advance!

© Stack Overflow or respective owner

Related posts about bash

Related posts about shell-scripting