• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cron expression for every 45 minutes

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm using like this my cron expression :"0 0/45 * * * ?"

The above cron expression executing every 45 minutes and it's executing on every hour like 10.10am,10.55am,11.00am,11.45....
I need to execute cron expression for every 45 minutes like 10.10am,10.55am,11.40am,12.25...
Could you please any body can help me on that.
Note:Cron expression needs to execute every 45 minutes only like 10.10am,10.55am,11.40am,12.25...
Regards,
Madhu
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To quote from the Wikipedia article about cron:

There is also an operator which some extended versions of cron support, the slash ('/') operator (called "step"), which can be used to skip a given number of values. For example, "*/3" in the hour time field is equivalent to "0,3,6,9,12,15,18,21".

So "*" specifies 'every hour' but the "*/3" means only those hours divisible by 3. The meaning of '/' specifier, however, means "when the modulo is zero" rather than "every". For example, "*/61" in the minute will in fact be executed hourly, not every 61 minutes.



I would conclude from that quote that "*/45" in the minutes field means "at minutes divisible by 45", not "every 45 minutes".

I don't see anything in the article which says anything about "every X time units" except for that quote and one place which mentions "every 5 minutes" -- which is the same as "at minutes divisible by 5". So I conclude you can't do that with cron. Especially since your experiment tends to confirm what the Wikipedia article says.
 
reply
    Bookmark Topic Watch Topic
  • New Topic