Search code examples
windowswindows-server-2003

How to restart program automatically if it crashes in Windows?


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?


Solution

  • 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.