views:

26

answers:

3

So my situation is that I am running an app on the Windows Task Scheduler. This app is run once a day at 1pm. the app does some queries and transfers data to an FTP site. All that is working great except on the weekends when i am not here the app is run and the GUI is still displayed for me to review. This seems to make it stop running on the scheduler until I shut down the app. So on Saturday it will run and the app will remain displayed for me to review when I get back on Monday. but on Sunday when the scheduler attempts to run it again it will fail because the app has not been closed down.

First let me confirm that this is how the Task Scheduler is supposed to work. Second, what are my alternatives for scheduling to run every day and keep the GUI displayed so that I can review. The app can run multiple times as each session does not interfere with the other sessions. So if I'm gone for a week on vacation I would expect that when i get back that 7 instances of the app have been run and are waiting for my review.

Thanks AGP

A: 

This is the default behavior of the Scheduled Task system, as it doesn't know that the job is complete until the application actually exits. Therefore, if your application is still open after 24 hours, the next run will simply be skipped because the current run is "still going" as far as the scheduler is concerned.

Personally I would re-visit the way that you handle your job process, as your are setting up a scenario that will be hard to manage long term.

Mitchel Sellers
No doubt that I will re-visit the process. I started by manually running it for a week and reviewing the results. once i was happy with the process I put it on the scheduler but i still want to review for errors at least until I am confident that it can be run automatically with no errors.
sinDizzy
+1  A: 

Your best bet is to eliminate the UI and log messages to the Event Log or a log file. The UI could be spawned from the CLI as a separate process if you prefer, but it should be done so in as its own non-child process.

Alternatively, you could run a batch file instead of the process directly. In the batch file, invoke "START path_to_exe" instead of the EXE. That will cause the batch file to "finish" instantly, and the exe to be run in its own process. This is not a good long term solution, but will give you a temporary solution to your immediate problem.

James Schek
For the meanwhile I have to manually review a dataset so I cant for the moment just write to a log file. But you have given me some good ideas. I also looked at third party schedulers but as has been stated these are all temporary solutions. Your insight is duly noted.
sinDizzy
A: 

I recommend writing to a log file instead of displaying a UI for any output and/or errors. This way, the application can write, then exit, and you can review the log at your convenience. This is a very common solution for automated processes.

ChessWhiz