I have a python program that is running in process A; and I have a shell script like this:
#!/bin/bash
# Kill the process A
# Do something...
# Start the process A
Actually I want to execute the above shell script from my python program (process A) to kill the process A, do some operations and restart the python program again. I have used the subprocess module to achieve this:
subprocess.Popen("./script.sh")
The problem is that when the shell script code kills the process A, the process in which the shell script is running, is killed too and the operations is not done.
Now my question is How can I start a process B from process A and kill the process A from within the process B, but the process B continues running?