What is best practice for ensuring a program is running?

I am wondering what is considered the best way to do the following:

  • Check if a program is running
  • If it is running, move on.
  • If it isn't running try to start it.
  • Check that it started ok
  • If not try again based on some conditions (# of retries, duration of time, etc)
  • If it started ok, move on
  • If it still isn't started, throw a failure so I can determine how to handle it.

Is there a best practice for this? Or maybe somebody has already build an Action Group or Action Script for this scenario.

I am looking forward to seeing how you folks do this.

Hi Chaim,

No, we don’t have any best practices for doing what you’ve asked as it can vary depending on the environment where the project is to be run (for example, is WMI available?). The actions that could be used to determine whether the process is running are; Wait For Process, WMI Process Iterator or the PsList action. Each of these have slightly different settings to control the behaviour so you’ll need to decide which action you want to use, then go from there.

Regards,
Paul.

Have you thought about building it as a service? Services have all those functions automatically. Here’s the MS KB on the subject.

http://support.microsoft.com/kb/137890