Task scheduler retry when console app fails?

0

Possible Duplicate:
How to make TaskScheduler fail when the task returns result different from 0

I have a windows task scheduled that runs a console application (.exe file) i have written. I have set the task to retry after 5 minutes up to 3 times on failure.

The task scheduler always see's the task as completed successfully. Even when the application throws an exception.

Is there a way to return something from the application when an exception is thown to tell the task that it has failed. For example and ExitCode?

Or, is there a better way to set up the task so I can tell it there has been an error?

SteveHansen

Posted 2013-01-11T20:28:05.113

Reputation: 1

Question was closed 2013-01-12T04:45:03.553

Answers

0

If possible, you could try to set up another scheduled task, a few minutes later, that would check whether the previous task has had the desired effect (checking whether X is running correctly, whether X variable is worth what you want, whether X file's last modification is today, etc.) and if not, do the same task as the first.

My guess is that the "retry on failure" feature is "if the task scheduler couldn't launch the task". If it did, and the program it launched bugged, "it's not its problem". You ask it to launch, and it launches, period. That's the way I understand it.

So I think your best way is to set up one or more additional tasks that will run a check.

If what you're doing (say, upload a file) is not checkable directly, then you can try to tell the app you launch, if possible, to log each of its results or dates for successful operations.

If not possible, perhaps there are other apps that can monitor a program and output what it does. App which you would launch with the first task as well. It gets complicated, but. :/

Ariane

Posted 2013-01-11T20:28:05.113

Reputation: 1 907