
Windows only 
There is a good chance that you’ve had a program crash on your while you were away from your computer, and it probably caused quite a headache. Maybe you have a web server or FTP server at home, and the application running it crashed when you were at work leaving those files inaccessible. Another good one is when you start a download before you leave home, and when you return you realize that the download didn’t finish because the program crashed.
If you’ve found yourself in this situation then you may want to take a good look at this free Application Monitor. You can set it to monitor the status of a running program, and it can automatically restart it should the program inadvertently get stopped. Just specify what process should be watched, how often you want it checked, and what command you want executed when the program is found not running.
The nice thing is that you get to specify the command you want run after a program has crashed. That means you can also point it to a batch file in case you need something done before the program starts. Or, if you really wanted, you could set it to restart your computer if a particular program crashes. This guide might help you with some other ideas of things you can run when a program crashes.
Application Monitor Homepage for Windows
Thanks for the tip Jason!

Some years ago I was working on this game server, and sometimes it would crash. However, there was a file in which you would open it by, instead of the .exe, called Restarter.bat, and it would automatically restart it, in case it crashed and closed.
I can’t remember the command, but it’s pretty easy and should be easy to find on Google.
What if Application Monitor crashes?
Someone had to say it…
There’s an application monitor monitor…ummm, application
Why? Most programs that are worth running are either stable enough to not need this, or run as a service and recover on their own. The only thing I can think of that this would work on is some game servers, but even this wouldn’t fix those occasions where the server hangs and the process doesn’t ever get killed.
Here’s a simple shell-script which does virtually the same.
Choice.exe from NT/W2K/W2K3-Ressource Kit is needed.
@echo off
:loop
REM ***
REM *** Start application
REM ***
start /wait notepad.exe
REM ***
REM *** Application ended.
REM *** Give user chance to abort the loop for 30 seconds
REM ***
choice /T 30 /C YN /M “Notepad ended. Restart? (Y in 30 seconds)” /D Y
REM ***
REM *** No choice given or pressed ‘y’
REM *** Restart application
REM ***
if %errorlevel%==1 goto :loop
REM ***
REM *** Choice ‘n’ given
REM *** Loop ends here
REM ***
Well, you’re screwed.
Yes and no. I’ve had some BitTorrent applications crash on me when dealing with extremely large files. And it’s frustrating to have left it alone to download for an entire day, just to realize later on that it crashed shortly after starting.
Nice script… thanks for the info.