# What is best practice for ensuring a program is running?

**URL:** https://www.finalbuilder.com/forums/t/what-is-best-practice-for-ensuring-a-program-is-running/4405
**Category:** Discussion
**Created:** [November 14, 2009, 3:42am UTC](https://www.finalbuilder.com/forums/t/what-is-best-practice-for-ensuring-a-program-is-running/4405 "2009-11-14T03:42:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tinjaw](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/tinjaw/32/73_2.png) [@tinjaw](https://www.finalbuilder.com/forums/u/tinjaw)
#### Post date: [November 14, 2009, 3:42am UTC](https://www.finalbuilder.com/forums/t/what-is-best-practice-for-ensuring-a-program-is-running/4405/1 "2009-11-14T03:42:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [November 22, 2009, 10:57am UTC](https://www.finalbuilder.com/forums/t/what-is-best-practice-for-ensuring-a-program-is-running/4405/2 "2009-11-22T10:57:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [January 27, 2010, 9:43am UTC](https://www.finalbuilder.com/forums/t/what-is-best-practice-for-ensuring-a-program-is-running/4405/3 "2010-01-27T09:43:45Z")

</div>

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](http://support.microsoft.com/kb/137890)
