I have a long running tool I’ve written. It, unfortunately, isn’t super reliable and sometimes crashes. I’ll call it myscript.py
.
I run it with a launcher script called launch
, which sets some env variables for my script.
Is there a way to run ./launch
, but where if it crashes, it will automatically restart after two minutes, and if it crashes again, it will wait four minutes, and then if it crashes again, eight minutes, and so on, but it will never wait more than 64 minutes between retries?
Is there a command I can install that can do this restart functionality automatically? Alternatively, I’m open to a custom shell script or possibly doing it with a systemd service if that’s possible.