-1

I have used http://www.cronmaker.com/ to generate Cron Expression I need to run job every 45 minutes but seems there is something wrong with Cron expression or Quart.Net. Please look at following outputs and suggest me solutions.


Cron format: 0 0/45 * 1/1 * ? *

Next scheduled dates

1.Tuesday, August 16, 2016 1:45 PM

2.Tuesday, August 16, 2016 2:00 PM

3.Tuesday, August 16, 2016 2:45 PM

4.Tuesday, August 16, 2016 3:00 PM

5.Tuesday, August 16, 2016 3:45 PM

Thanks in Advances

1 Answers1

1

You can't do that in one line of cron magic. You need three.

0,45  0-23/3 * * * foo
30    1-23/3 * * * foo
15    2-23/3 * * * foo
Matthias Urlichs
  • 2,301
  • 19
  • 29
  • Thanks Matthias for help. I understood that Cron is not interval based its time based.Do you have any idea how can one save schedule in database? something like Cron expression? – Samee Daris Aug 17 '16 at 22:02
  • While you can of course store a schedule in a database by various means, in cases like this I'd simply store the interval and the time when next to run the task. In fact I've written some scheduling code in Python which you can ask "next time it's 1 o'clock, after " and which you could use for implementing a rather flexible scheduler. https://github.com/M-o-a-T/moat/blob/master/moat/times.py – Matthias Urlichs Aug 18 '16 at 06:09
  • Thanks Matthias.I will look into it. – Samee Daris Aug 31 '16 at 18:37