I have a VPS running a simple python scripts. However, sometimes the script crashes. How can I make sure the script starts agian?
Python – Restart python script if it crashes
pythonscripting
Related Topic
- Python – Using IPMI inside a python script (OpenIPMI)
- Python – Run python script automatically on apache server
- Python – Keeping a Python Script alive after leaving SSH Client
- Linux – Run a python script that is never Killed
- Python – IIS Won’t Let Python Script Set Headers
- Python script fails only when run as a service
Best Answer
Run it via daemontools. It's a very simple, straightforward framework for doing exactly what you want -- it'll run the script and wait until it exits, and then start it again. It even takes care of the daemonisation, so you only have to write the script to run in the foreground, and daemontools handles all the tricky stuff. Comes with a neat stdout/stderr logging system, too, which handles the other usually-painful part of running a custom daemon.