Quartz 添加job执行

private void ExecuteJob(int hour = 10, int min = 10, int ss = 0)
{
    ISchedulerFactory factory = new StdSchedulerFactory();
    IScheduler scheduler = factory.GetScheduler();
    scheduler.Start();

    IJobDetail jobDetail = JobBuilder.Create<ScheduleJob>().WithIdentity("dailyJob").Build();

    ITrigger trigger =
    TriggerBuilder.Create()
    .WithIdentity("jobTrigger")
    .WithSimpleSchedule(x => x.WithIntervalInHours(24).RepeatForever())
    .StartAt(DateBuilder.TodayAt(hour, min, ss))
    .Build();
    scheduler.ScheduleJob(jobDetail, trigger);
}

 

posted @ 2016-06-13 18:17  楊柳  阅读(1171)  评论(0编辑  收藏  举报