We help IT Professionals succeed at work.

Automatically Restarting an Application

Greetings,
I am looking for a way to automatically restart an appilcation if it fails. We are running an application that uses it's on print service to print work orders. This does not run as a process and there is not a problem with Windows Print Services. I need some way to restart the .exe automatically if it fails.
The application ( Four Rivers TMS ) runs on a Windows 2000 sp4 server.
Comment
Watch Question

Commented:
If the app runs via a Service you can go into the Service's Recovery tab and set the Service to recover. Very nice.  This is for Windows 2000 and 2003.

If you have an application that doesn't run from a service, you can create your own Service to run the app.

Here is the step by step.

http://support.microsoft.com/kb/137890/en-us
you will need 2 scripts or merge the two of them

----- KILL APPLICATION
ProcessToKill = "rsh.exe"
Set WMI=GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery ("select * from Win32_Process")
For Each Process in WMI
	If process.name = ProcessToKill Then
		Process.terminate
	End If
Next
 
 
------ RESTART APPLICATION
 
Dim MyShell
  Dim shell_cmd
 
  shell_cmd = "C:\Program Files\Windows NT\wordpad.exe"
  set MyShell = CreateObject("WScript.Shell")
  MyShell.Run shell_cmd, 1, 1

Open in new window

Commented:
My suggestion is a software called AlwaysUp:

http://www.coretechnologies.com/products/AlwaysUp/

AlwaysUp will allow you to automatically run a software after it crashes so that it is always running. It has a lot of neat functions like the ability to monitor the program and shut it down if it starts hogging too many resources. From the website:

It will automatically restart your application if it crashes, hangs, or uses too much memory, dismiss "Application error" dialogs, and run customized "sanity checks" to ensure that your application is available 24/7. Regular, detailed email from AlwaysUp will keep you abreast of crashes, scheduled restarts and other relevant events.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.