Sharepoint Timer Job - on which server is the job running?

If I install a function (timer job) on the front end Sharepoint server in the farm, which server is running the job? All of them?

The task is locked at the job level, and the Execute method calls the web service on one specific farm machine, which processes all the processing. My question is, will all front end servers try to start this work?

Or the network guys want to provide a new server in the farm, so this task does not eat up the resources of the main server, but it seems to me that we will duplicate the task.

Confused Does anyone know the answer to this question?

+4
source share
2 answers

The timer job can actually be deployed in one instance (or all of them, if you want). This link gives a good answer:

Deploying a timer job through constructors

+3
source

In SharePoint 2010, see How to run code on all web servers :

MyTimerJob myTJ = new MyTimerJob( "contoso-job-add-mobile-adapter", webApp, null, SPJobLockType.None); 

Pay attention to the following code:

The third parameter can be used to indicate the specific server on which the job should run. This value is null when the job should run on all front-end web servers.

The fourth parameter determines whether the job runs on all front-end Web servers. Passing SPJobLockType.None ensures that it will run on all servers running the Microsoft SharePoint Foundation Web Application Service. In contrast, passing SPJobLockType.Job ensures that it only runs on the first available server that runs the Microsoft SharePoint Foundation Web Application Service. (There is a third possible meaning. For more information, see SPJobDefinition and topics for its constructors and other members.)

+3
source

All Articles