Thursday, August 02, 2012 2:54 PM
I am having a strange issue where a Sql Agent job created by Sharepoint 2010 shared schedule is still running even though it is past its expriation time. I can manually modify the agent job to disable it and/or the schedule and it will react as expected, but when attempt to pause the schedule from Sharepoint there is no affect. I am most worried by the fact that the sql agent job is still running even after the expiration time has passed however.
Any ideas on what may be causing this behavior? I am using Sql Server 2012 and Sharepoint 2010.
Thursday, August 02, 2012 4:02 PM
I do not believe that pausing a schedule will end a running job. Pausing the schedule would prevent the job starting again once it completes. See: http://msdn.microsoft.com/en-us/library/bb326287(SQL.105).aspx
One comment in that article is: "A job that is in progress is outside the scope of the scheduling engine."
If you have a need to terminate a job that is still running when the schedule is past its expiration time, you could create another job that checks for this circumstance and runs an sp_stop_job to stop that job from processing any further.
Wednesday, August 22, 2012 7:32 PM
that is correct, pausing a schedule from sharepoint actually deletes the agent job on the sql server, as does delete schedule. What is happening here is that when you tell the sharepoint schedule to "Stop running this schedule on: ", the Sql Agent job in turn sets its own schedule to end on the date given, and at the time minus one minute that was given as the starting time. This time portion is then ignored by the schedule thus allowing the agent job to run up until midnight of the end date given.
While in some cases this is ok, since I have to have a schedule end at a certain time during the day, I have to go in manually and either pause the schedule or diable the agent job. This seems to be a bug that should be looked in to at some point.
Wednesday, August 22, 2012 9:20 PM
I see. But would my comment from before work for you?
"If you have a need to terminate a job that is still running when the schedule is past its expiration time, you could create another job that checks for this circumstance and runs an sp_stop_job to stop that job from processing any further."
If the jobs are being created and deleted it is a little more work no doubt, but should still be doable.