Kill / respawn application automatically every X minutes
Posted on 2011-10-02
I have an application that I need to let run in the background to handle some tasks on a Windows Server 2008 machine. The problem is, there are some bugs in the application that cause it to crash/hang between every 60 to 120 minutes. I don't have the source code so I can't really jump in and isolate the problem...
I do need to keep this application up and running in the meantime until I find a replacement, so it looks like my only option would be to:
1. Automatically kill / respawn this program every X minutes (say, every 45 minutes)
2. Catch any apphang/appcrash errors and kill / respawn the program upon detection.
With regards to #2, when an app crashes / hangs... it appears that the process isn't killed. It just gives me an option "Close this program" or "Check for a solution online." Is there a way to avoid this so that when the app crashes or hangs the process is just allowed to die without any user input... this way the solution above can identify a missing process?
Is there a way to do this with a simple windows batch script or maybe some existing 3rd party software? Or should I look into trying to write something in C#?