I have a script running python script.py
in a new screen but sometimes the script gets killed:
18
21
Restarting processes... done
2
Killed
How can I protect the script from being killed even when I close the console? Shall I use & or nohup?
kill-processlinuxpythonscripting
I have a script running python script.py
in a new screen but sometimes the script gets killed:
18
21
Restarting processes... done
2
Killed
How can I protect the script from being killed even when I close the console? Shall I use & or nohup?
Best Answer
I would recommend adding this code to your script http://code.activestate.com/recipes/278731-creating-a-daemon-the-python-way/
Or use screen.
Edit: This is a little more modern but I haven't used it(I use something custom) http://pypi.python.org/pypi/python-daemon