Thursday, January 20, 2011

STSADM Extensions for rescheduling Timer Jobs

Managing the timer job schedules is not easy in SharePoint. To update the schedule of a timer job, the code needs to be modified or we should have an admin screen (some tools available on codeplex) to edit the timer schedule.


One of the other simpler option that i found is to use the stsadm extensions created by Gary Laponite - http://stsadm.blogspot.com/. These extensions provide lot of options on the command line. Here lets see how to use the stsadm command line extensions for updating timer job schedule. These extensions have a prefix "gl" to the normal stsadm operations.


1) Get information of a timer job:
    stsadm -o gl-getjobinfo -job "Timer Job" -URL
   This command gives the details of the timer job like Timer schedule, type, next occurrence, when the job last ran etc


2) Set the schedule for specified job:
This has many options. We can set the timer job schedule as a Minute/Daily/Monthly/Daily schedule.




Parameters:
        -job
        -url
        -scheduletype


For a daily schedule:
        -beginhour
        -beginminute
        -beginsecond
        -endhour
        -endminute
        -endsecond


For a minute schedule:
        -beginsecond
        -endsecond
        -interval


For a monthly schedule:
        -beginday
        -beginhour
        -beginminute
        -beginsecond
        -endday
        -endhour
        -endminute
        -endsecond


For a one time schedule
        -time


Ex:
stsadm -o gl-setjobschedule -job "Timer Job" -URL  -scheduletype daily -beginhour 13 -beginminute 30 -beginsecond 00 -endhour 14 -endminute 00 -endsecond 00


Running the above command sets the timer to run the job daily at 1:30 PM


This way we can reschedule the timer job


Thanks to Gary Laponite for these wonderful commands. Check out the other stsadm extensions @ http://stsadm.blogspot.com
http://blog.falchionconsulting.com/index.php/stsadmpowershell-commands/









No comments: