Quartz.NET 定时任务使用

    class Program
    {
        static void Main(string[] args)
        {
            StartJob();
            Console.ReadKey();
        }
        static void StartJob()
        {
            IScheduler sched = new StdSchedulerFactory().GetScheduler();
            JobDetailImpl job = new JobDetailImpl("jdBossReport", typeof(Job));
            IMutableTrigger triggerReport = CronScheduleBuilder.DailyAtHourAndMinute(21, 28).Build();   // 每天 23:45  执行一次
            triggerReport.Key = new TriggerKey("triggerReport");
            sched.ScheduleJob(job, triggerReport);
            sched.Start();
        }
    }
    class Job : IJob
    {
        public void Execute(IJobExecutionContext context)
        {
            Console.WriteLine("任务执行成功,{0}", DateTime.Now);
        }
    }
原文地址:https://www.cnblogs.com/kikyoqiang/p/10822582.html