Is it possible to execute a schedule job within a schedule job .For Instance ,I have a schedule job A that does some operations .There is another schedule job B that executes after Schedule Job A is executed. So rather than manually going and running the job using admin mode which is a straightforward option, Is there a way wherein I can execute job B after Job A is executed successfully? I found an interface IScheduledJobExecutor which looks like it does but i am not sure if this is advisible to do that. Any thoughts on this?
Asked
Active
Viewed 308 times
0
-
1"Start Manually" inside `EPiServer.UI.Admin.DatabaseJob.StartNow_Click` does exactly this `IScheduledJobExecutor.StartAsync` - so why not? – Lanorkin May 06 '22 at 09:59
1 Answers
0
I would not create dependencies between scheduled jobs like that. Instead, consider refactoring your code so that the business logic of both operations can be carried out in the same scheduled job.
So, let's say you refactor your code into Foo()
and Bar()
.
Then create the following for maximum flexibility:
Scheduled Job A
which executesFoo()
onlyScheduled Job B
which executesBar()
onlyScheduled Job C
which executes bothFoo()
andBar()
Obviously, you might not need #1 and #2 unless there is good reason for executing the operations individually.

Ted Nyberg
- 7,001
- 7
- 41
- 72
-
I do get your point but out of the two jobs that I have ,there is only 1 I can control. The other is a 3rd party schedule job. These two jobs needs to run sequentially one after another & so I am looking out for a way that makes sure that the two executes one after another. – Ms1 May 06 '22 at 09:29
-
Ah, I see, in that case I think `IScheduledJobExecutor` is the way to go. – Ted Nyberg May 06 '22 at 12:11