My problem is that i want to keep a Python app running, but it stops every 2-3 days. Is there a way to autorestart the .py when it stops. Is there a way to monitor that? Probably there is but i can't find it.
Thanks for the help.
My problem is that i want to keep a Python app running, but it stops every 2-3 days. Is there a way to autorestart the .py when it stops. Is there a way to monitor that? Probably there is but i can't find it.
Thanks for the help.
There really isn't any reason why a python app should suddenly stop running. I would suggest looking into why it stops (crash, out of memory, ...) and trying to solve that.
If you really just want to restart it tough it depends on how you start it in the first place.
If you for example start it as a systemd service you should set the
Restart=on-failure
property in your systemd unit file.If you just start it using the commandline you can use a simple bash loop: