Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We are going to build a medium farm and would like to split the timer jobs across the CA and WFE server.

How do I set which timer job runs on which server?

share|improve this question
    
Note: In central admin -> Application Management -> Manage content databases -> Click content database -> at very bottom of this “content database settings” page, you set "Preferred Server for Timer Jobs". However as Benjamin J Athawes mentioned below this is only a preferred server and the server on which the timer job runs is tied into services running on the server. –  REVA Dec 13 '12 at 23:02
    
Also Check simple-talk.com/dotnet/.net-tools/… -> Section "Which Server Does the Timer Job Run On" –  REVA Dec 24 '12 at 16:16
add comment

3 Answers

up vote 3 down vote accepted

Are you referring to out of the box or custom timer jobs?

You can use the "Timer Job Status" page within Central Administration to view scheduled and running jobs - the "Server" column shows you where the job is being run.

I am not aware of a means of directly changing where a timer job will run. However, it's worth noting that the location is likely tied to the services that are running on each server. For example, stopping the "Web Analytics Data Processing Service" on a server will have a knock on effect on the corresponding timer jobs that are run. A timer job acts as a trigger to start a specific Windows service.

For development purposes, the SPJobDefinition.LockType Property determines whether the job runs on one server only or on all servers in a farm. I would not recommend using this approach to modify the OOB timer jobs as I'm not sure that it's supported.

share|improve this answer
    
Also have a look at the SPJobLockType enumeration on MSDN to see where a custom timer job may be run. msdn.microsoft.com/en-us/library/… –  James Love Jun 8 '11 at 16:20
add comment

TimerJobs can take an SPServer as constructor parameter. I've seen this but never used it before, so no idea if it'll work. Using SPJobDefinition.LockType.Job locks it on 1 specific machine, but you'll have no guarantee which one that'll be.

share|improve this answer
add comment

We can use the manage the Timer job as below

protected SPJobDefinition(
    string name,
    SPService service,
    SPServer server,
    SPJobLockType lockType
)
 and this we can call from feature receiver and we can set all the parameter 

public override void FeatureActivated(SPFeatureReceiverProperties properties)
 {
        SPServerCollection servers = SPFarm.Local.Servers;

          SPServer myServer = servers["myExistingServer"];
          myServer.Name = "NewServerName";
          myServer.Role = SPServerRole.Application;
          myServer.Update();
          TimerJob timerJob = new TimerJob("JobName", SPService,myServer ,SPJobLockType.Job );
            SPDailySchedule schedule = new SPDailySchedule();
            schedule.BeginHour = 3;
            schedule.BeginMinute = 0;
            schedule.EndMinute = 30;
            schedule.EndHour = 3;
            timerJob.Schedule = schedule ;
            timerJob.Update();

      }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.