Running Timed Jobs within SharePoint

Introduction

Microsoft Windows SharePoint Services (WSS) and its Portal version, Microsoft Office SharePoint Server (MOSS), carries out various automatic, scheduled jobs to realize repetitive tasks in a standard way. For example, the alerts and notifications engine scans new items added to a site in a timetabled way and sends emails to users. Additionally, information generated from the log files to make statistical analysis occurs in pre-determined time intervals.

The SharePoint Timed Jobs infrastructure takes care of the scheduled tasks needed to ensure proper functioning of the system. Timed Jobs run in the background and are based in the Microsoft SharePoint Timer service, which is always installed in the default setup of WSS and MOSS. Installed Timed Jobs can be configured from SharePoint's Central Administration using the Command-Line administrator's tool or programmed using the Object Model.

Timed Jobs can be set up to run immediately or in a time frame based on "one," meaning a SharePoint Job can run each minute, day, or week but not, for example, every two hours or days. Another limitation is that it is impossible to schedule Jobs to run on relative time frames; for example, the second Monday of every month. A Timed Job requires a starting time, and the configured time frame determines the interval it will run at. The starting time can be an absolute time (at 12:00 am, for example) or a time range (between 8:00 and 9:00 am); in the first instance, the Job would require a few seconds to execute because the service needs to be initiated; in the second case, the Job will run at a random time within the range, giving the different servers in the farm the opportunity to progress at varied periods, balancing the load on the system.

Finally, the Timed Jobs system relies on the Gregorian calendar, based on a 24-hour clock. The user configures the initial time using the local time of the SharePoint server, and the system calculates the offset from the Universal Coordinate Time (UTC) to store it.

Using the SharePoint Administration Pages

The Central Administration of SharePoint provides the location to configure a specified Job. For instance, it is possible to set up "Use Confirmation and Deletion" of sites in a Portal: If there is no traffic in a site, the system sends a notification to the owner. If there is no confirmation of use, after a number of send notification without confirmation, the site can be configured to delete.

This is a characteristic use of Timed Jobs; the Job engine runs the process in a time-tabled way, detects whether a site has been approached, and compares the time span with the configured value. It then sends an email if necessary, and eventually, if unconfirmed, deletes the site. Figure 1 displays the Central Administration Page to configurate the procedure. In the example, the Timed Job has been scheduled to run every day at 12:00 am, and after 3 unanswered messages, the site is deleted.

For the general administration of all Jobs, the SharePoint Central Administration has "Timer job status" and "Timer job definitions" pages (in the Central Administration, under the "Operations," "Global Configuration" section).

The "Timer job status" page provides information about the server: where the Job has run (it can be a separate entry for each server in a farm), the Status of the Job, Progress indication if the Job is still running, and the date when the Job ran for the first time.

The "Timer job definitions" page shows all the Timed Jobs defined in the system, the scope of the Job, and the schedule type (time frame). Each entry in the page is a link to a specific page, where it is possible to enable/disable the Job and to change its name.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.

Thanks for your registration, follow us on our social networks to keep up-to-date