Restart the app after possible crash

Greetings,

Assuming I am creating an app to run on the desktop, and for some reason it crashes on runtime. Assuming that I have some logs about the crash and sentry set up to fix them down the line.

What would be a recommended way to restart the app after crash, without user involvement?
Some sort of watchdog which launches the app if it is not running.

Target: Windows, Raspberry pi, and maybe one day MAC

On Windows, create your app as a Windows Service. When you add it, you can specify what to do when it crashes (relaunch X times after X minutes).

Alternatively for macOS and Linux, for a server application that I needed to collect logs, I created a helper Console app that checked every minute if the main Console app I needed was running. If not, I logged the issue and started it. The main Console app launched the helper Console app at startup.

Thank you David,

This should get me started. I am curious to see if there are any more GUI based/Dummy proof options proposed by the community.

The console app, is another step up, I might first try to build a webapp and use Lifeboat which I think has a watchdog built-in

Best Regards,
Eugene

macOS has that built in with LaunchAgents. The screenshot is from Lingon Pro which can inspect/edit/create LaunchAgents:

3 Likes