I am on Ubuntu 16.04.5 LTS (AWS)
I am creating a python process via this command:
nohup python -u main.py > nohup.out 2>&1 &
I would like to send a ctrl-c/SIGINT to the process, so I send
kill -2 <pid>.
When I start the process from my terminal, this works fine, the program receives the keyboard interrupt and closes gracefully.
When I start the process via a
.sh script or via another bash process (e.g.
bash -c 'nohup python -u main.py > nohup.out 2>&1 &'). (I believe both methods start the process in the same way), the process does not receive the SIGINT when I send it.
kill) works normally and closes the process, but does not let the process close gracefully, but I need.