Automatically Restart Crashed Or Hanged Applications

Don’t you hate it when programs hang or crash? I find it especially annoying when a background application like an IM client or a bandwidth monitor silently crashes – sometimes I only notice the problem hours later when I’ve already missed a bunch of messages. I’m sure you’ve encountered a few “Not responding” errors and some irritatingly crash-prone applications yourself.

If you have an unstable program that you absolutely need to run at all times, but don’t want to waste your time monitoring and manually restarting it every time it croaks, I might have something interesting for you.

Restart on Crash is an monitoring tool that will watch the applications that you specify and automatically relaunch any program that hangs or crashes. You can add any number of applications to monitor, enable/disable them individually and edit the command line that will be used to restart an application.

Restart on Crash doesn’t require installation and stores all it’s configuration data in a “settings.ini” file in the program’s folder, so it’s portable. It should be compatible with most NT-based Windows versions.

Download Restart on Crash (1.4 MB)

Screenshots & Documentation

Main application window

The main window

  • To add a new application to monitor, click the “Add” button or press the Ins key.
  • To delete on or more applications from the list, select them and click “Delete” or press Del.
  • To edit the per-application configuration, double-click the corresponding row. This will open the editing dialog (see below).
  • You can also access the RoC configuration by clicking “Settings” and view the activity log by clicking “Show Log”. The log contains information about crashed/hanged applications, executed commands, and so on.
Editing the monitor settings for an application

Editing the monitor settings for an application

Well, this one should be pretty self-explanatory 🙂 One detail to keep in mind is that enabling the “It isn’t running” option will make Restart On Crash treat the application as if it has crashed even if you have purposefully it closed it. You can get around this by disabling the monitoring of the application before you close it.

The configuration dialog. Yes, that's it.

The configuration dialog. Yes, that’s it.

“Grace period” is how long Restart on Crash will wait before trying to terminate/restart an application that it has just terminated/restarted. This is intended to prevent a scenario where RoC kills a hanged program, restarts it, decides it has hanged again (e.g. if the program is non-responsive while starting up) and wrongfully terminates it again.

Known Issues

  • If you configure RoC to automatically kill a hanged application, it will terminate all instances of that application when doing so. This may be fixed eventually.

Release Notes

2022-11-02

  • The “execute a command” feature can now launch shortcuts (.lnk files). Potentially, it can now run almost any type of file as long as file associations are set up correctly.

2019-12-17

  • Improved “application is not responding” detection.
  • Added a “Clear Log” button to the Log window.

2019-08-24

  • Added a “Restart Now” option to the application pop-up menu. It restarts the selected application immediately without waiting for the grace period to expire.
Related posts :

605 Responses to “Automatically Restart Crashed Or Hanged Applications”

  1. Andrei says:

    Could you add an option for setting the priority of the process? It can be done with the START command, but it doesn’t work with programs that use flags without “-” (ex: “c:\prog\prog.exe 2” ).

  2. Jethro_g says:

    W-Shadow,

    First of all let me state that your RoC is awesome! It has become an invlauble tool in my arsenal for system administration.

    I do have what should be a minor funcitonal change or suggestion. RoC monitors the process image name. Would it be possible to instead monitor the application task name?

    The problem I am having is that I have a 5 command based applications that when running will all show as cmd.exe in the processes of task manager. This confuses RoC into thinking that it is running even if one of them has actually crashed. However, because you can ghange the title of a command window, they do actually show up differently in the applications tasks.

    If there was a way that it could monitor both or have an option to get the task name as well, that would be great.

    Thanks,
    Jeff

    One other suggestion, have you considered sharing the source code for your app or possibly posting on Source Forge with the code. Since you dont charge for the app it would be a great way to get all of us admin/developers to assist in improving a very great app.

  3. Me again says:

    Process priority AND delay on start, that would be nice! Thanks.

  4. White Shadow says:

    @ Andrei:
    As far as I can tell, the “start” command does work for that purpose. You just need to change the syntax a little by placing the flags outside the quotes. For example, the following command appears to pass the flags just fine :

    start "" /LOW "D:\ShowCmdParams.exe" 2 3 -4 /5

    (ShowCmdParams.exe is a quick test app I wrote that simply outputs the command line arguments passed to it.)

    As for startup delay, I think you could use the “Wait X seconds and double-check” to achieve more or less the same thing.

    @ Jethro_g :
    That’s more complicated than it may seem. I probably won’t get around to implementing it any time soon.

  5. Still Me says:

    Of course system can’t find ‘start’, so the command doesn’t work. Start works inside CMD, so the proper command in RestartOnCrash is:

    CMD /C START “” /ABOVENORMAL “” ”

    /C – close CMD window after execution; /K for keep

    I’m asking for an option to delay an app on ROC start. I’ve got two game servers that hang each other if they start at the same time, or too soon at start-up. I’ll try the “Wait then double-check” and see if it works. Thanks!

  6. Killerko says:

    Hello, I’m serching the net for this kind of program.. this is the second one i have found but it’s still not working as I need… it does not detect that the application has stopped working… my app crashes with a dialog that the application has stopped working and you need to click or press enter to close that dialog (and the application will then close as well). Unless that is done the program ultimately thinks that the app is still running and will not restart it 🙁

    btw I run this under vista 32bit
    any help appreciated…

  7. White Shadow says:

    Maybe there is a way to disable that dialog?

  8. Killerko says:

    Not that I know of.. unless there is an option/settings/hack for vista how to disable this kind of dialogs and instead close the app as soon as it stops working there is no settings in this program… its very simple command line window where it post some statistics, no buttons nothing.. I run the .exe with my config.file to start it up.

  9. Killerko says:

    Ok I sorted it at last! You can disable windows error reporting in Local group policy editor for vista… under Computer Configuration > Administrative Templates > Windows Components > Windows Error Reporting. That way when anything crashes it just dissapear without any trace or dialog popping. Now it works perfectly fine with your program 🙂

  10. rainroom69 says:

    I tried to add a line as a test like this in the execute field, but I got an error.
    no program associated ….

    CMD /C START “” /ABOVENORMAL “U:\Portable Files\uTorrent\uTorrent.exe”

    what may be wrong ?

  11. rainroom69 says:

    Is there a way to start programs minimized or hidden ? Maybe this can be added ?

  12. White Shadow says:

    Try placing the command in a .BAT file, then using that file as the command line instead.

    The “start” has a /min flag that might do what you want. More info here.

  13. […] weitere Infos hier der Link: http://w-shadow.com/blog/2009/03/04/restart-on-crash/ Veröffentlicht in Software, Windows 7, kostenlos | Schlagworte: abgestürzte Programme […]

  14. remy says:

    Great thanks from the heart of the program made. Much of the software I needed to do things like that

  15. Vitale says:

    Hi, great progg, very useful on servers, but I wondering if it is possible to run controlled programs hidden to system tray?

  16. White Shadow says:

    Not with this program, but I imagine you could find a separate app for minimizing things to the system tray.

  17. Vitale says:

    2 White Shadow:
    Emmm… I mean why not implement souch function in this aplication so no need to install another one just for hidding to tray controlled apps. Lets say, I need to launch three gameservers and Your app doing it wonderful, but these three console windows keep stayin on desktop, and I did not found yet an appropriate program that will detect gameserver consoles start and hide them to system tray :'( This app hides itself to system tray on startup, which means it could hide controlled apps too if You will implement such option, or it’s too hard?
    Btw, the source code is GPL or private?

  18. White Shadow says:

    Alas, I think something like that would be outside the scope of this application; I don’t want it to turn into another bloated “do everything” tool. Check out Tray It!, it looks promising.

    The source code is private at the moment.

  19. […] that I still use today… the ‘Restart On Crash’ program. ROC can be found at w-shadow.com and I don’t mind giving a little link love to the author, as he has indeed made my life […]

  20. Thomas Dreher says:

    White Shadow, how does the ‘restart on crash’ determine if a monitored program hangs?

    I am monitoring a program which runs as a service and once in a while it hangs. In this state it cannot be stopped via net stop or the services applet, I have to kill it via the task manager. If it is in this state, restart on crash reports it as ‘running’ and does not kill it and restart.

Leave a Reply