Thursday, 2 August 2012

Deploying a Timer Job in a Single Farms and Multiple Farms

What apparently could look a piece of cake, deploy a timer job, some times could become a nightmare.

On single farms Timer Jobs are controlled by the SPTimerv4 service which establish all the Timer Jobs on the START. That means, if you deploy a timer job and activate it it will not work until you re start this service

If you are working in a single farm with only one server you should have a mayor problem, but I recommend you to follow these instructions before activating the feature, this is the best installation you can perform:

  1. Create a wsp package in Visual Studio.
  2. Copy the wsp package in the server you want to deploy the Timer Job (for instance c:)
  3. Go to the server were you want to deploy the solution and go to Start->SharePoint 2010 Management Shell
  4. Type Add-SPSolution
  5. It will ask for the identity, just type c:\nameofsolution.wsp
  6. Now let’s go to install it.
  7. Type Install-SPSolution –GACDeployment
  8. it will ask for the identity: just type nameofsolution.wsp
  9. Now type net stop sptimerv4
  10. Now type net start sptimerv4
  11. Now type iisreset
  12. Go to Site Collection Administration->Site Collection Features
  13. Activate the feature.

To Uninstalling the service

  1. Deactivate the feature by going to Site Collection Administration->Site Collection Features
  2. Uninstall-SPSolution -Identity nameofsolution.wsp –allwebapplications
  3. Remove-SPSolution –force
  4. then Type the identity: nameofsolution.wsp
  5. Now type net stop sptimerv4
  6. Now type net start sptimerv4
  7. Now type iisreset

On Multiple farms it is a different issue. For the start you need to synchronize all the clocks so the whole farm can run the Timer Job properly. Only the application pool owners from the particular server where site collection lives will be able to activate the feature. The other way, will be doing it with Enable-SPFeature via Powershell or use the famous stsadm.

Now, having a farm like this:

image

The first thing we will do is going to the Server 3 (Apps). This server is the one which contains all the services, and we will do the following:

  1. Copy the wsp package in the server you want to deploy the Timer Job (for instance c:)
  2. Go to the server were you want to deploy the solution and go to Start->SharePoint 2010 Management Shell
  3. Type Add-SPSolution
  4. It will ask for the identity, just type c:\nameofsolution.wsp
  5. Now let’s go to install it.
  6. Type Install-SPSolution –GACDeployment
  7. it will ask for the identity: just type nameofsolution.wsp
  8. Now type net stop sptimerv4
  9. Now type net start sptimerv4
  10. (optional) Now type iisreset

Now, for every single server, a apart of of Server 4, do the following:

  1. Go to the server were you want to deploy the solution and go to Start->SharePoint 2010 Management Shell
  2. install-spsolution nameofsolution.wsp -GACDeployment –force
  3. Now type net stop sptimerv4
  4. Now type net start sptimerv4
  5. (optional) Now type iisreset

Go to Site Collection Administration->Site Collection Features and try to activate the feature. If you get an Access Denied, will be because you are in the wrong server, and your app pool identity doesn’t have access to it. I recommend you going to any other server to do it or just type the following from Powershell:

type Enable-SPFeature , and then type the name of the feature.

To remove the Timer Job, I suggest you to disable the feature first and then do the following:

  1. Uninstall-SPSolution -Identity nameofsolution.wsp –allwebapplications
  2. Remove-SPSolution –force
  3. then Type the identity: nameofsolution.wsp
  4. Now type net stop sptimerv4
  5. Now type net start sptimerv4
  6. (Optional) Now type iisreset

 

Conclusion: Timer Jobs are natural services for Sharepoint and become a really useful tool when you want to perform really complex operations. It is all controlled by Sharepoint so you don’t need to worry about, but only remember, theses steps so you don’t spend more time deploying it than developing.

4 comments:

ninest123 said...

replica watches, louis vuitton, air jordan pas cher, longchamp pas cher, ray ban sunglasses, nike air max, oakley sunglasses, ugg boots, oakley sunglasses, nike free, nike roshe run, louboutin shoes, michael kors, louboutin, longchamp outlet, louis vuitton outlet, polo ralph lauren outlet, longchamp outlet, tiffany jewelry, tiffany and co, jordan shoes, tory burch outlet, ugg boots, air max, louis vuitton, replica watches, nike free, louis vuitton, uggs on sale, sac longchamp, burberry, chanel handbags, oakley sunglasses, polo ralph lauren outlet, louboutin outlet, longchamp, louis vuitton outlet, prada outlet, cheap oakley sunglasses, oakley sunglasses, christian louboutin outlet, louboutin pas cher, ralph lauren pas cher, ray ban sunglasses, kate spade outlet, ray ban sunglasses, nike air max, prada handbags, gucci outlet, nike outlet

ninest123 said...

burberry outlet online, nike air max, coach purses, nike air max, michael kors, timberland, new balance pas cher, true religion jeans, kate spade handbags, nike free run uk, north face, true religion jeans, ralph lauren uk, air force, hollister pas cher, ray ban uk, converse pas cher, lacoste pas cher, michael kors outlet, michael kors outlet, ugg boots, michael kors outlet, michael kors outlet, coach outlet, vans pas cher, hollister, burberry, coach outlet, nike blazer, oakley pas cher, vanessa bruno, mulberry, ugg boots, lululemon, hermes, tn pas cher, ray ban pas cher, sac guess, hogan, true religion jeans, abercrombie and fitch, true religion outlet, michael kors, nike air max, michael kors outlet, replica handbags, michael kors, nike roshe, north face, michael kors

ninest123 said...

longchamp, iphone 5s cases, hollister, ferragamo shoes, herve leger, jimmy choo shoes, giuseppe zanotti, north face outlet, vans shoes, mont blanc, nike huarache, celine handbags, iphone cases, iphone 6s cases, nike trainers, lululemon, louboutin, ralph lauren, iphone 6 cases, babyliss, s5 cases, hollister, north face outlet, nfl jerseys, bottega veneta, soccer shoes, oakley, baseball bats, abercrombie and fitch, ghd, chi flat iron, valentino shoes, beats by dre, asics running shoes, wedding dresses, reebok shoes, timberland boots, ipad cases, mac cosmetics, mcm handbags, nike roshe, nike air max, insanity workout, iphone 6s plus cases, birkin bag, p90x workout, hollister, instyler, iphone 6 plus cases, soccer jerseys, new balance

ninest123 said...

barbour jackets, toms shoes, lancel, supra shoes, juicy couture outlet, moncler, moncler, louis vuitton, thomas sabo, hollister, canada goose uk, canada goose, louis vuitton, doudoune canada goose, converse outlet, canada goose outlet, replica watches, bottes ugg, canada goose outlet, nike air max, gucci, moncler, pandora jewelry, canada goose, karen millen, marc jacobs, converse, moncler, ray ban, wedding dresses, montre pas cher, ugg,ugg australia,ugg italia, moncler, pandora charms, canada goose, moncler, canada goose, ugg,uggs,uggs canada, moncler, vans, swarovski crystal, sac louis vuitton pas cher, pandora jewelry, juicy couture outlet, louis vuitton, louis vuitton, moncler outlet, coach outlet, swarovski, ugg boots uk, links of london, ugg pas cher, pandora charms