Try our conversational search powered by Generative AI!

Scheduled job - need to run on each instance in web farm

Oct 26, 2010 12:44

I have next server configuration - three web server under load balancing work with one db. I create scheduled job, that need to start on each instance each "next scheduled date", but it starts only the one random instance. see below part of job history

10/26/2010 10:40:24 AM OK Finished. Processed 13 destinations at SERVER3 server for 2 seconds

10/26/2010 10:15:24 AM OK Finished. Processed 13 destinations at SERVER2 server for 2 seconds

10/26/2010 9:50:24 AM OK Finished. Processed 13 destinations at SERVER1 server for 1 seconds

The question is - how to prevent scheduler from check - was the task run on the other instance?

Oct 26, 2010 12:46

Ivan, this behaviour is by design. A sceduled job is only ever meant to run once, on any of the web servers. You can control which machine scheduled jobs run on by using the "enableScheduler" flag in web.config. If you need communicaton between machines as a result of running a sceduled job then I advise looking into the EPiServer events system:

If the job needs to run on each machine then you are better off looking at a Windows Service.

Oct 26, 2010 13:39

Hi Ivan!

Simply put: you dont.
The scheduler is written in such a way that the job will be executed on *one* of the connected servers. You *could* modify the stored procedures to circumvent this behaviour but its really not recommended...

A workaround could be to make use of EPiServers remote event functionality and have the code execute whenever a specific event is raised, and then have the server that happens to check out the scheduled job simply raise the event.

More on events here:


Oct 26, 2010 13:39

Congrats David, you beat me with 8secs :-)


Oct 26, 2010 13:40

No worries Johan - I'm simply glad I got the answer correct :)!

Oct 26, 2010 13:57
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.