DailyAtHourAndMinute()
works , but why is StartNow()
ignored?
TriggerBuilder.Create().WithIdentity("engineTriggerII", engineGroup).StartNow().WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(0, 0)).Build();
version 2.3.3.0
DailyAtHourAndMinute()
works , but why is StartNow()
ignored?
TriggerBuilder.Create().WithIdentity("engineTriggerII", engineGroup).StartNow().WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(0, 0)).Build();
version 2.3.3.0
That is the expected behaviour.
You're telling your trigger to fire every day at midnight so it will never fire now ... unless you're running it at midnight.
I guess you'll have to create 2 triggers to achieve what you want.
You can check when the trigger is scheduled to run using this code:
private static void GetNextXFireTimes(ITrigger trigger, int counts)
{
var dt = trigger.GetNextFireTimeUtc();
for (int i = 0; i < (counts-1); i++)
{
if (dt == null)
{
break;
}
Console.WriteLine(dt.Value.ToLocalTime());
dt = trigger.GetFireTimeAfter(dt);
}
}
and you can call it after you've scheduled your job:
Scheduler.ScheduleJob(job, trigger);
GetNextXFireTimes(trigger, 100);
and you should see something like this:
18/09/2015 00:00:00 +01:00
19/09/2015 00:00:00 +01:00
20/09/2015 00:00:00 +01:00
21/09/2015 00:00:00 +01:00
22/09/2015 00:00:00 +01:00
23/09/2015 00:00:00 +01:00
24/09/2015 00:00:00 +01:00
25/09/2015 00:00:00 +01:00
26/09/2015 00:00:00 +01:00
27/09/2015 00:00:00 +01:00
28/09/2015 00:00:00 +01:00
29/09/2015 00:00:00 +01:00
30/09/2015 00:00:00 +01:00
01/10/2015 00:00:00 +01:00