How do you instruct a SharePoint farm to run a timer job on a specific server?

We have an SP timer job that works for quite some time. Administrators recently added another server to the farm, and therefore, SharePoint decided to run this timer job on this other server. The problem is that the server does not have all the dependencies installed (that is, Oracle) on it, and therefore the work does not work. I'm just looking for the path of least resistance here. My question is: is there a way to make the timer job work on the server you want on?

[edit] If I can do this with code that works for me. I just need to know what the API should do if it exists.

+5
source share
5 answers

I apologize if I insist on the evidence; I just did not see anyone else painting it.

The restriction of a user-defined timer job (i.e., a custom class of timer jobs that comes from SPJobDefinition) is implemented by controlling the constructor parameters.

Timer jobs are typically run on the server on which they are sent (as vinny indicated) if no target server is specified during the creation of the timer job. However, two overloaded constructors for the SPJobDefinition type accept SPServer and SPJobLockType as the third and fourth parameters, respectively. Using these two parameters correctly will allow you to determine where your task is performed.

SPServer SPJobLockType "Job", , .

, , . MSDN: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spjobdefinition.spjobdefinition.aspx.

, , . , (?); , /, SPFeatureReceiver. FeatureActivated , .

, ( ), , . (, Factory). , SPFeatureReceiver .

, !

+7

. -, , , .

+2

-.

, , "" NT.

+1
source

I think that a side effect of setting SPJobLockType to "Job" is that it will run on the server where the job will be sent.

+1
source

You can deploy a web service with business logic and deploy this web service to a single computer. Then your timer job can periodically run your web service.

This should not be so important if your timer job is running. SharePoint decides where to start the timer job.

0
source

All Articles