c# – Quartz.NET. Setting up a trigger for a call after 5 minutes. after the start and then every day at 10:00


Hello. It is necessary according to the regulations to interrogate the web server.

The schedule is as follows every day at 10:00 and 1 time in 5 minutes immediately after the start of the program.

I was able to set up a trigger call at 10:00

            ITrigger trigger = TriggerBuilder.Create()
            .WithIdentity("trigger3", "group1")
            .WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(10, 00))

But how to add 1 draw immediately 5 minutes after the start?

 scheduler.ScheduleJob(job, trigger);        // начинаем выполнение работы

You can add 2 triggers.

            ITrigger trigger = TriggerBuilder.Create()  
             .WithIdentity("trigger", "group1") 
             .WithSimpleSchedule(x => x           

        ITrigger trigger2 = TriggerBuilder.Create()
            .WithIdentity("trigger2", "group1")
            .WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(22, 04))

        scheduler.ScheduleJob(job, trigger);

Everything works fine, but a trigger call is added right after the program starts. That is, 3 calls: after the start, after 10 seconds, and every day at 22:04.

How to remove the 1st call immediately after the start.


In the first trigger, you explicitly tell it to run on startup: .StartNow() .

Scroll to Top