aspose file tools*
The moose likes General Computing and the fly likes Cron expression : run every midnight 23:59:59 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Cron expression : run every midnight 23:59:59" Watch "Cron expression : run every midnight 23:59:59" New topic
Author

Cron expression : run every midnight 23:59:59

Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
Is there any difference between 59 59 23 * * * and 59 59 23 * * ?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10913
    
  12

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?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7052
    
  16

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


Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
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

Joined: Oct 02, 2003
Posts: 10913
    
  12

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

Joined: Mar 17, 2011
Posts: 7052
    
  16

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cron expression : run every midnight 23:59:59
 
Similar Threads
SCEA Beta submission Time
Over all Scjp Exam?
Tomorrows date
I would like to have your advice about the way I have designed the application
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators