Question
Asked By – zihaoyu
I have Python script bgservice.py
and I want it to run all the time, because it is part of the web service I build. How can I make it run continuously even after I logout SSH?
Now we will see solution for issue: How to run a script in the background even after I logout SSH?
Answer
Run nohup python bgservice.py &
to get the script to ignore the hangup signal and keep running. Output will be put in nohup.out
.
Ideally, you’d run your script with something like supervise
so that it can be restarted if (when) it dies.
This question is answered By – Edward Dale
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0