Scheduling Timed Jobs

Several features of Microsoft Windows SharePoint Services rely on scheduled background processes. For example, to be able to review usage analysis (usage analysis: Data collected to evaluate how a Web site is being used, such as visitor user names, number of visits to each page, and the types of Web browsers used.) information, you must first gather the information, preferably when your site is not being heavily used. With Windows SharePoint Services, you can schedule the following operations to occur automatically at specific times.

Operation Frequency Scope
Processing the usage analysis log files Daily Web server
Sending alert notifications Immediately, daily, or weekly Content database
Checking for and automatically deleting unused Web sites Daily, weekly, or monthly Content database
Checking for and automatically adding e-mail attachments from a specific public folder to a specific document library (document library: A folder where a collection of files is stored and the files often use the same template. Each file in a library is associated with user-defined information that is displayed in the content listing for that library.) Every few minutes, hourly, or daily Content database

Scheduled times apply to all Web sites on a particular virtual server. The scope determines how the job is run. If a job is scoped to the Web server level, it is run for each Web server computer, independently of any other Web servers that might be hosting the same content. If an operation is scoped to the content database level, it is run once for the content database, which means once for the each content database in the entire server or server farm.

The Microsoft SharePoint Timer service, a background utility, handles scheduled jobs in Windows SharePoint Services. This utility is installed to your Web server (Web server: A computer that hosts Web pages and responds to requests from browsers. Also known as an HTTP server, a Web server stores files whose URLs begin with http://.) when you set up Windows SharePoint Services. The SharePoint Timer service relies on the Gregorian calendar for scheduling. For every job you schedule, you must specify a beginning time for that job based on a 24-hour clock. You specify the time in local time versus an offset from Universal Coordinated Time (UCT), and the time is stored in that format as well.

The dates used by the SharePoint Timer service are not stored in context. This means that you cannot schedule jobs to run every X days/weeks/months/years, where X is greater than 1. So, while you can schedule jobs to run every day, every week, or every month, you cannot schedule a process for every two days, and so on. Neither can you schedule jobs for relative days in a month, such as the third Monday of every month.

When you schedule a timed job, you schedule the beginning time for the job. For example, you can schedule a job to be run daily, beginning between 1:00 A.M. and 2:00 A.M. You always schedule jobs to begin within a time range, rather than at a specific time. This allows the SharePoint Timer service to be run at a random time in that range, so that not every server in a server farm is running the scheduled job at the same time. For example, if you set usage analysis processing to be done during the range 1:00 A.M. to 2:00 A.M., each front-end Web server starts processing usage analysis sometime between 1:00 and 2:00 A.M.

Using HTML Administration Pages to Schedule Jobs

You can schedule timed jobs by using HTML Administration pages. To schedule a timed job, go to the page that contains the settings for the job you want to schedule, and then select the day, date, month, year, and time that you want the job performed. For example, if you want to schedule usage analysis processing to be performed daily at 3:00 A.M., you would use the Configure Usage Analysis Processing page to specify the time to run the log processing. For more information about scheduling specific timed jobs by using HTML Administration pages, see the following topics:

Using Command-Line Properties to Schedule Jobs

You can also set properties on the command line to schedule timed jobs. Alert and site use confirmation jobs can both be scheduled by using command-line properties. You use the setproperty operation with Stsadm.exe to schedule timed jobs. The setproperty operation takes the propertyname and propertyvalue parameters, as well as the -url parameter. For a timed job, the propertyvalue parameter is the frequency and time when you want the job to be performed.

When you schedule a job from the command line, you use one of the following formats to specify the frequency and time:

Job frequency Example time format
Immediate "every 5 minutes between 0 and 59"
Daily "daily between 22:00:00 and 06:00:00"
Weekly "weekly between Fri 22:00:00 and Mon 06:00:00" or "weekly at Sat 0:00:00"

For example, to schedule a job to be processed daily between midnight and 1:00 A.M., you would specify the propertyvalue parameter as:

-pv "daily between 0:00:00 and 01:00:00"

For more information about scheduling timed jobs from the command-line, see Command-Line Properties.

Restarting the SharePoint Timer Service

If you need to restart the SharePoint Timer service on a Web server computer, you can do so by using the Services control panel.

 Note   To restart the SharePoint Timer service you need to be a member of the local computer's Administrators group or you need to have been granted permissions to manage services on the local computer.

Restart the SharePoint Timer service
  1. Click Start, point to All Programs, point to Administrative Tools, and then click Services.
  2. In the Services (Local) pane, right-click SharePoint Timer Service, and then click Restart.
 
 
Applies to:
Deployment Center 2003