0

How can I schedule Task for every day between 8-11 AM for every 5 mins ? What would be config entry for this ?

Filip De Vos
  • 11,568
  • 1
  • 48
  • 60
Ocean
  • 293
  • 3
  • 14

4 Answers4

1

You could also use Quartz Scheduler DailyTimeIntervalScheduleBuilder class :

Trigger trigger = (Trigger) newTrigger().withSchedule(DailyTimeIntervalScheduleBuilder.dailyTimeIntervalSchedule().startingDailyAt(new TimeOfDay(8,0)).endingDailyAt(new TimeOfDay(11,0)).withInterval(5, IntervalUnit.MINUTE));
Anthony Dahanne
  • 4,823
  • 2
  • 40
  • 39
  • I am driving jobs scheduler through config file; I am looking in following format : ing in below format: 0 0 12 1/1 * ? * I am not setting up jobs scheduler through code... – Ocean Apr 13 '12 at 19:19
1

0 0/5 9 * * ?

See this for the meaning of how to construct the cron expression for quartz scheduler. You can also test the cron expression by this website

Ken Chan
  • 84,777
  • 26
  • 143
  • 172
0

If I understand correctly for what you are asking, you would create a line in your crontab that looks something like this:

0,5,10,15,20,25,30,35,40,45,50,55 8,9,10 * * * command to execute what you want to do

Hope that helps!

Here's another source of information explaining crontabs -

http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

Lobos
  • 1
  • 2
  • Ahhh, ok. I see now that this is tagged as c#, so perhaps you are in the realm of M$. I was looking at this strictly from a simple Linux / UNIX shell / crontab perspective. Sorry if that didn't help. – Lobos Apr 13 '12 at 18:37
0
  ITrigger trigger = TriggerBuilder.Create()
                     .WithIdentity("trigger1")
                     .StartNow()
                     .WithSchedule(
                     DailyTimeIntervalScheduleBuilder.Create()
                     .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(8,0)).EndingDailyAt(TimeOfDay.HourAndMinuteOfDay(10,0)))
                      .Build();
hamid reza mansouri
  • 11,035
  • 2
  • 22
  • 32