0

I need to import different feeds at different times, and my plan is to set up separate scheduled tasks, i.e. one that runs weekly, one monthly and so on, with different arguments depending on which feeds should be run. My question is what the best practice is when doing that - should I check if the exe is still running for example? I know you can set up the scheduled task to queue up an instance if it's already running, but that only applies to the task and not the exe. I don't think it will be too process heavy, so it should be fine if several instances were running at the same time, but I'd just like to check in case I'm missing some obvious pitfalls.

Thanks,

Annelie

annelie
  • 2,569
  • 6
  • 25
  • 39

2 Answers2

1

There won't be any issues with Task Scheduler. You can run the same executable in different tasks concurrently with no trouble.

There are potential issues in your application, of course. You'll want each separate instance to be writing to a different output file, or if they're using the same output file you'll need to synchronize access. Unless you're writing to a database, which will typically handle that synchronization for you.

Jim Mischel
  • 131,090
  • 20
  • 188
  • 351
1

One way to control a single instance of your application running is to use a Mutex. However, there shouldn't be any problem with just using the Task Scheduler for doing what you want - of course, this is all dependent on what your program is doing. You will have to handle synchronization depending on your program logic.

This question has some relevant information about using a Mutex for enforcing a single instance.

Community
  • 1
  • 1
Bryan Crosby
  • 6,486
  • 3
  • 36
  • 55