Python Forum

Full Version: Run a Python script reliable on a server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have written my first python application for my server and I’m not sure how to run it reliably. What is the most robust and professional way to run and reset it automatically?

Right now I’m running it in a screen session. Should I create a daemon or write an additional watchdog, which monitors all events? My highest priority is uptime. I have searched quite a lot, but haven’t found a good solution. Thank you for your answers!

Best regards

Chris
It's difficult to determine exactly what you are looking for.
see: https://python-forum.io/misc.php?action=help&hid=19
Maybe I explain my problem in more detail:

I have a python application “important_service.py”, which does some networking and database stuff. It runs all the time on a dedicated server with Debian 10. The application itself runs really stable, but I’m not sure how to run it on the server and do the error handling, that it resets automatically in case of an reboot or memory error without intervention.

Right now I just open a screen session over ssh and started the script with “python3 important_service.py“ and detach the session afterwards. But in case of an error it just stop and has to restart manually. Imagine the program contains the flight software of a spaceship. How would you configure the script execution in order to get the highest safety standard?
Have you checked PyPi.org?