1

We are using quartz scheduler for scheduling and I have a requirement where I need to execute a job for every 2.5 hours. Please build a cron expression for this. Thanks in advance.

Rocky
  • 129
  • 2
  • 12
  • 4
    *"Please build a cron expression for this."* Please do your own work or show some effort and ask a specific question. – Andrew Thompson Nov 05 '12 at 04:42
  • Not a real question, vote to close – MadProgrammer Nov 05 '12 at 04:43
  • If you can build it build it and show me.. You cant do that and there is no right to degrade others you lol............ Andrew Thompson – Rocky Nov 05 '12 at 05:45
  • If you cant solve some question you people post not a real question and close the question. If you dont understand ask people to explain the question more clearly... You dont know the answer so you close the question thats what I unsderstand...MadProgrammer – Rocky Nov 05 '12 at 05:53
  • Its a challenge for you Mr. Andrew Thompson you answer this question I agree your reputation in this site is worthable. I you cant your reputation is such a shit on the road........... – Rocky Nov 05 '12 at 05:59

1 Answers1

5

This means that you have you have to execute the script at the following timings 0.00, 2.30,5.00,7.30,10.00,12.30,15.00,17.30,20.00,22.30
I am not sure whether you can write this in a single cron command. You can follow the below procedure.
You can split this into two halves. 0.00,5.00,10.00,15.00,20.00 and
2.30,7.30,12.30,17.30,22.30 You can add 2 entries in cron
0 */5 * * * CMD
and
30 2,7,12,17,22 * * * CMD


Hope this helps you..

Konza
  • 2,143
  • 17
  • 30
  • I think this is a wrong answer anyway: it is still executing for every 2 hours. Scheduled time will be: 0:30, 2:30, 4:30, 6:30 .... – Adrian Shum Nov 05 '12 at 05:03
  • yup You are correct... this is what I understood from his question. – Konza Nov 05 '12 at 05:05
  • I believe OP is asking for "every 2 and a half hour", that means, "every 2.5 hour", which means something like : 0:00, 2:30, 5:00, 7:30... – Adrian Shum Nov 05 '12 at 05:06
  • Oh okay. I mis interpreted the question.. – Konza Nov 05 '12 at 05:16
  • Thanks for your understanding.......Adrian Shum. If possible please help me........ – Rocky Nov 05 '12 at 05:48
  • @Rocky: What have you tried? Show us what you tried, instead of just blaming other for telling you about your question is not asked appropriately. Back to your question, two way u can choose: 2 cron expression, or switch to other scheduling method instead of using cron – Adrian Shum Nov 05 '12 at 06:10
  • 1
    Since this question is closed. I have edited my above answer. – Konza Nov 05 '12 at 06:10
  • @Rocky - I have edited the answer. Please check whether it helps you.. – Konza Nov 05 '12 at 06:20
  • 1
    +1 for putting up a right answer after getting it wrong in the first attempt – sactiw Apr 05 '13 at 19:18
  • There is an argument missing. 0 */5 * * * --> 0 */5 * * * ? ||||| 30 2,7,12,17,22 * * * --> 30 2,7,12,17,22 * * * ? Cause CronExpression require 6 fields. See: https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm#insertedID0 – Naxos84 Oct 09 '17 at 06:00