How to get details of all scheduled jobs and triggers in Quartz.NET c#

Brij picture Brij · Jul 15, 2011 · Viewed 11.9k times · Source

I have to create administration page of all scheduled jobs and triggers. How can i get details of running jobs and triggers in Quartz.NET? Can I pause/stop or update jobs? Is there any sample code?

Answer

Clayton picture Clayton · Jul 17, 2011

Here is how you would go about it using the StdSchedulerFactory

ISchedulerFactory schedFact = new StdSchedulerFactory();
foreach (IScheduler scheduler in schedFact.AllSchedulers)
{
    var scheduler1 = scheduler;
    foreach (var jobDetail in from jobGroupName in scheduler1.JobGroupNames
                              from jobName in scheduler1.GetJobNames(jobGroupName)
                              select scheduler1.GetJobDetail(jobName, jobGroupName))
    {
         //Get props about job from jobDetail
    }

    foreach (var triggerDetail in from triggerGroupName in scheduler1.TriggerGroupNames
                                  from triggerName in scheduler1.GetTriggerNames(triggerGroupName)
                                  select scheduler1.GetTrigger(triggerName, triggerGroupName))
    {
         //Get props about trigger from triggerDetail
    }
}