Scheduled tasks are common business requirement of any server based application. In order to run any scheduled tasks in a share point world. Microsoft has introduced timer jobs in Microsoft Office SharePoint Server (MOSS) 2007. Microsoft uses timer jobs to do things like dead web cleanup (purging unused sites from site collections) among others. Timer jobs run under SharePoint Central Administration. Timer Job Definitions link under Operations in Central administration gives the list of timer jobs running under Central Administration.
Custom timer jobs can be used do custom scheduled tasks such as sending mails , based on some date in lists on scheduled time basis, or list value updating etc. Once your timer job has been installed (something you can easily do with a feature), you can view its status through Central Administration and even disable/enable it, all without console access to your production servers.
The OWSTIMER.EXE in \12\BIN\ runs the scheduled jobs for SharePoint. Details of the jobs are stored in SharePoint’s content database (WSS_Content_) in the table ‘ScheduledWorkItems’, Like other SharePoint tables Microsoft recommend developers not to touch this table.
OWSTIMER.EXE runs as a windows service viz called Windows SharePoint Services Timer and invokes and monitor sptimer jobs. In order to debug timer job we need to attach OWSTIMER.EXE process to the debugging code. When a new timer job is created for Sharepoint, it has to be programmatically installed in a SPWebApplication.JobDefinitions of type SPJobDefinitionCollection.
If the timer job have to receive some configuration settings during run time, need to refer “OWSTIMER.EXE.config” residing in the same location as OWSTIMER.EXE.Using SPSchedule object is an easy way of scheduling timer jobs in code.