quartz.net regular tasks

Installation quartz package version 2.6.1

. 1  public  class TimingJob: IJob
 2          {
 . 3              public  void the Execute (IJobExecutionContext context)
 . 4              {
 . 5                  // be the timing of the code execution logic is written in here 
. 6                  systemstate = to false ;
 . 7              }
 . 8          }
Mission code
 1 ISchedulerFactory sf = new StdSchedulerFactory();
 2             IScheduler scheduler = sf.GetScheduler();
 3 
 4             IJobDetail job = JobBuilder.Create<TimingJob>().WithIdentity("job1", "mygroup").Build();
 5 
 6             ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(5)).WithCronSchedule("0 0 1/3 * * ? ").Build();
 7 
 8             scheduler.ScheduleJob(job, trigger);
 9             scheduler.Start();
10 
11             QuartzState = true;
Open run

Time (Cron) expression: https://www.cnblogs.com/-sylar/p/8367625.html
Online Cron Expression Builder: http://cron.qqe2.com/

Guess you like

Origin www.cnblogs.com/huangtaiyi/p/11165699.html