2

On a Windows 2003 server, I want a scheduled task that calls a VBS page every 3 minutes, running a script in my website application. The website script is written in classic ASP, and checks for uploaded files that can be converted in to different sizes and formats, so depending on how many files are involved, it can be a lengthy process - which is why I've opted for a background process.

What I would like to know is: If my server runs a schedule, finds a large set of photos and starts processing them, what happens if another schedule runs 3 minutes later, calling the same ASP page, and the previous task is still running? Will that affect the previous task or will it run along side the other task in a new instance, so-to-speak? If it did run alongside, would that not be server intensive? Should I build a DB table that manages the tasks, setting the channel to "busy" while a task is processing, resetting it to "open" when it's finished, so only one task can be processed at a time?

I'm worried that I have to process one task at a time, in my case, one folder of photos at a time. When my office uploads photos, photos of high importance to clients, they need to be published on the website as fast as possible. So if there were 100 folders, just uploaded, by the time the scheduled task reached folder 100, processing one task at time, it would be many hours later.

I know there's lot of question marks in there, but they all boil down to the same thing :) Any help or suggestions will be gratefully received. I'm also tagging this as .NET because I'm sure the process is the same.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
TheCarver
  • 19,391
  • 25
  • 99
  • 149
  • Have you thought of using WMI instead? Scheduled tasks is possible but what you're asking for is what WMI was created to do: auto poll every x amount of time for event(s) – Lizz Mar 28 '13 at 01:29

1 Answers1

0

A simple solution:

When the scheduled task starts, have it attempt to exclusively lock a dummy file.

If it obtains an exclusive lock, proceed.

If not, do nothing and exit. Task will kick off again at the next scheduled time.

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541