Reputation: 734
I am using this statement -
trigger2 = TriggerBuilder.newTrigger()
.withIdentity("abc", "group1")
.withSchedule(CronScheduleBuilder
.cronSchedule("0/30 0 14-23 * * ?"))
.build();
Somehow the trigger is fired at 2 pm, 2:00:30 pm and no more. What is the problem?
Upvotes: 0
Views: 856
Reputation: 5067
From quartz scheduler documentation I extracted the following example:
Job #1 is scheduled to run every 20 seconds
JobDetail job = new JobDetail("job1", "group1", SimpleJob.class);
CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1", "group1", "0/20 * * * * ?");
sched.addJob(job, true);
Adapting to your situation it should go like this:
CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1", "group1", "0/30 * 14-23 * * ?");
Upvotes: 0
Reputation: 750
The problem is that you have put 0 in the minute field.So it fires only at 2:00. Try
trigger2 = TriggerBuilder
.newTrigger()
.withIdentity("abc", "group1")
.withSchedule(
CronScheduleBuilder.cronSchedule("0/30 * 14-23 * * ?"))
.build();
Upvotes: 3