How to restart program automatically if it crashes in Windows?

Zahid picture Zahid · Feb 18, 2012 · Viewed 49.1k times · Source

How can I start my program automatically if it crashes on windows 2003 server? Sometimes my program just crashes, is there a way in windows or settings that I can set?

Answer

David Heffernan picture David Heffernan · Feb 18, 2012

The usual approach is to run what is known as a guardian process. This is a separate process, often a service, that monitors the state of the main process. When the guardian detects that the main service has died, it re-spawns it.

To the very best of my knowledge, there is not built in Windows functionality to do this for you.