Scheduled jobs

Scheduled jobs in Episerver run in the background at preset time intervals and typically perform cleanup and updating tasks. A sample installation of Episerver has several predefined scheduled jobs that are administered in the admin view. You can customize and configure scheduled jobs and create your own.

How it works

During the initialization of Episerver, the system scans through jobs and checks for their next execution time. At the appointed time, the system executes the job. Alternatively, you can execute a job manually from admin view. Because scheduled jobs are executed on the site, the site's web server must be up and running. To ensure this, use the IIS feature "Application Initialization," or have a site supervisor periodically ping the site. Scheduled jobs are executed in an Anonymous context.

Default scheduled jobs

A standard Episerver installation comes with a set of built-in scheduled jobs, such as emptying the trash and managing the scheduled publishing of content. These jobs are available from the CMS administration view.

Multi-site scenario

If several sites share a database, such as in a load-balanced scenario, you can control which site executes scheduled jobs. To do this, set the enableScheduler attribute to true on the applicationSettings configuration element on the site that should execute the jobs, and to false on the other sites.

If you configure several sites to run scheduled jobs, each job is scheduled for execution on all sites. However, during execution, the first site that starts executing a job marks it in the database as executing, so the other sites do not execute that job in parallel.

Comments

Sorry if there's any confusion with the documentation. This particular document does give a short example implementation of how you can create a scheduled job via VS extension and then implement a scheduled job by marking a class with the ScheduledPlugInAttribute and then inherit fromEPiServer.BaseLibrary.Scheduling.JobBase base class. The code example is slightly incorrect as it should inherit from JobBase, not from ScheduledJobBase.

If anything is unclear with a particular doc, you can post some feedback on our forums: http://world.episerver.com/forum/.