I have a shell script that runs python.
start.sh
# Setup environment
cd ~/foobar/ && \
python3 -m venv env && \
source env/bin/activate && \
pip install -q -r requirements.txt && \
find . -maxdepth 1 -type f -name "*.py" | xargs pylint
# Run scripts
python ~/foobar/main.py
If I ctrl+c
in the terminal, it will shutdown the python properly. However if I pkill -9 start.sh
, it will prompt Killed
but the python is still running. Is there a way to kill the python script when the calling script dies?
-9
(is there a good reason for it?) or by the fact thatstart.sh
really was in the process list (can you confirm it?)-9
? if you send-2
instead everything goes as if you typed ctrl+c from the terminal