I'm working on a Python script that is supposed to restart itself.
This is what I do in the Python script
os.execl('run.sh', '')
My run.sh then looks like this
#!/bin/bash
sudo fuser -ku 8000/tcp
python /home/app.py
The reason I use sudo fuser -ku 8000/tcp is because it was kind of easy because my python script was the only one using port 8000.
When I run the python script it does this and stops.
8000/tcp:             7587(pi)  7596(pi)  7597(pi)  7605(pi)  7606(root)
./run.sh: line 3:  7587 Killed                  python /home/app.py
It never restarts the python script.