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 correspoding 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.
Related posts :

410 Responses to “Automatically Restart Crashed Or Hanged Applications”

  1. Enoch Bryant says:

    I tried that, but it kept restarting the bat file and not running it even though it properly runs outside of restart on crash. I even tried to convert the .bat file to a .exe, but same result.

  2. Enoch Bryant says:

    I already tried that, the bat file just restarts over and over

  3. Jānis Elsts says:

    Hmm, that’s weird. Did you set the .bat file just as the command to execute, or also as the application to monitor? It should only be the command, the “monitor this application” field should still be the actual .exe.

  4. Enoch Bryant says:

    Ok, thanks for the tip, that worked. I had to set my .bat file to

    stransmit-rendezvous-GRE.exe” -s:1000 “udp://127.0.0.1:9009” “srt://172.28.1.224:9500?mode=rendezvous&latency=6000&conntimeo=10000” -r:1>C:\Tools\SRT\log.txt

    Then select the .exe as the file to monitor and set the .bat file only in execute a command, I now have a log file. The only thing to figure out now is how to send to cmd window and log file. With the above setup, I only have the -v in the log file

  5. Jānis Elsts says:

    I think there are ways to do that with PowerShell scripts, but I’m not very familiar with it. See this SO thread for example:
    https://stackoverflow.com/questions/1215260/how-to-redirect-the-output-of-a-powershell-to-a-file-during-its-execution

  6. Nick says:

    Can you open source this or fix the CPU issue? I have a new PC and this constantly uses about 12% CPU monitoring 20 processes.

  7. Jānis Elsts says:

    I’ve just uploaded a new version that should have noticeably better performance when monitoring many applications at once. Please give it a try.

  8. Peesjee says:

    FYI,

    if there is a new version of Restart-On-Crash i can simulate a crash:

    1. Start RoC (that already has the new ‘detection’ system that there is a new version available)
    2. A new popup appears telling there is new version (but not in foreground, so i had first missed this) -> don’t click ‘Get Update’
    3. doubleclick on the icon in the right-bottom corner -> Crash!

    Greetz
    Pieter

  9. ExCo says:

    When I attempt to download the new update, the page goes blank before the following error is displayed:

    Your connection is not private

    Attackers might be trying to steal your information from 1.shadowcdn.com (for example, passwords, messages, or credit cards). Learn more

    NET::ERR_CERT_COMMON_NAME_INVALID

    What is the problem?

  10. Jānis Elsts says:

    That looks like some kind of a problem with the SSL certificate on the CDN domain. Try this download link instead:
    http://w-shadow.com/files/RestartOnCrash-v1.6.zip

Leave a Reply