标签:
ISchedulerFactory sf = new StdSchedulerFactory(); IScheduler sched = sf.GetScheduler(); IJobDetail job = JobBuilder.Create<HelloJob>().WithIdentity("作业名称", "作业组").Build(); ; //创建一个作业 ITrigger trigger1 = TriggerBuilder.Create() .WithIdentity("触发器名称", "触发器组") .StartNow() .WithDailyTimeIntervalSchedule(d => d.WithIntervalInHours(24).OnEveryDay().StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(18, 39)))//每天执行 //.WithSimpleSchedule(x => x.WithIntervalInSeconds(2).RepeatForever())//间隔两秒执行 .Build(); sched.ScheduleJob(job, trigger1); //把作业,触发器加入调度器。 sched.Start();
标签:
原文地址:http://www.cnblogs.com/jiecaoge/p/4779259.html