• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cron expression : run every midnight 23:59:59

 
Saurabh Pillai
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any difference between 59 59 23 * * * and 59 59 23 * * ?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12101
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't think a question mark was allowed in a crontab file. I did a quick google, and found there is a cron extension that allows it in the first four positions.

I'm really not sure what would happen if you put it in the last spot.

What OS/Cron are you using?
 
Winston Gutkowski
Bartender
Pie
Posts: 10277
60
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saurabh Pillai wrote:Is there any difference between 59 59 23 * * * and 59 59 23 * * ?

Yes. Apologies for stating the bleedin' obvious, but one has five components and the other has 6.

And what that means almost certainly is that one form is invalid (I suspect the first).

Also: what does this have to do with Java?

Winston
 
Saurabh Pillai
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is Windows 7. and I use http://www.quartz-scheduler.org/api/2.1.0/org/quartz/CronExpression.html , that is why I thought to post it to Java forum.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12101
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:
Saurabh Pillai wrote:Is there any difference between 59 59 23 * * * and 59 59 23 * * ?

Yes. Apologies for stating the bleedin' obvious, but one has five components and the other has 6.

I assumed the two cron expressions were

59 59 23 * * *

and

59 59 23 * * ?

both have six components. But it is hard to tell from the original post which is the correct interpretation.

Also, I moved the thread to General Computing.
 
Winston Gutkowski
Bartender
Pie
Posts: 10277
60
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saurabh Pillai wrote:It is Windows 7. and I use http://www.quartz-scheduler.org/api/2.1.0/org/quartz/CronExpression.html , that is why I thought to post it to Java forum.

Well, for future reference, please TellTheDetails (←click), because that makes a huge difference.

From what I can see, the CronExpression class requires 6 fields (standard Unix cron only has 5), and the ? in the final one (which I took to be part of your question) means 'no specific value', which I suspect equates to the same thing as *; but not having used the system, I can't be sure.

My advice: suck it and see.

Winston
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic