7

I have an exe, that starts when Windows Server 2008 SP2 is booting. It runs all the time and performs an important task (fetching mail for exchange). With the help of the Windows Task Scheduler I want to check if this process is still running. What trigger do I choose? Or might there be some workaround with a batch program?

2 Answers 2

5

One option may be to have it run on an interval, perhaps every 15 minutes, and on the Settings tab, configure "If the task is already running" for "Do not start a new instance". That way you can ensure it would be no longer than 15 minutes if it stops running.

2
  • yes, thats a good solution. one problem is though that the exe is started via a batch script to set up some logfiles and the batch file itself is no running process. before i tried to kill the process and starting it again within the same batch script, ensuring the process is not run twice, but this didnt work out 100% of the time.
    – Björn
    Jan 3, 2012 at 13:36
  • 2
    Would it not be an option to have the script run in a loop? Seems like doing that would obviate the need for hooking into some kind of event or having an external process check on it.
    – Greg Askew
    Jan 3, 2012 at 14:26
0

This is going to have to be done with scripting or programming. For example, write a Powershell script that checks the list of running processes every few minutes, and then performs some action if process x is not on the list.

http://technet.microsoft.com/en-us/library/ee176855.aspx

1
  • If you're willing to code in C (or any other language that can access the Windows API) you don't need to poll. Once you've found the process in question, do a wait on the process handle; the wait will complete when/if the process exits. Jan 5, 2012 at 21:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .