Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a job scheduled via Quartz and a CRON Expression. The goal of my CRON expression is to run every 10 minutes every day between Monday and Friday between 08:00 AM and 20:00 PM and looks like this:

0 0/10 8-19 ? * MON-FRI

My execution log looks like this:

2010-02-24 19:10:00,140 INFO  - Start
2010-02-24 19:20:00,015 INFO  - Start
2010-02-24 19:30:00,015 INFO  - Start
2010-02-24 19:40:00,015 INFO  - Start
2010-02-24 19:50:00,000 INFO  - Start //Execution expected at 20:00 PM
2010-02-25 08:00:00,000 INFO  - Start
2010-02-25 08:10:00,000 INFO  - Start
2010-02-25 08:20:00,000 INFO  - Start
2010-02-25 08:30:00,000 INFO  - Start
2010-02-25 08:40:00,000 INFO  - Start
2010-02-25 08:50:00,000 INFO  - Start
2010-02-25 09:00:00,000 INFO  - Start
2010-02-25 09:10:00,000 INFO  - Start

I would like that my CRON expression will fire my job at 20:00 PM. Question: Can this be accomplished using one CRON expression? which one?

Thank you very much in advance

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Why should it run at 20:00? You specify that the hour should be 8-19, so 20:00 doesn't match that. I am not sure if there can be a single line cron expression to accomplish your needs, but you could easily add a line

0 20 * * * ...

in addition to the existing one, that should do the trick.

share|improve this answer
    
Thanks for your reply, actually my "workaround" is just using two cron expressions. My question is just for improving my skills. –  SourceRebels Feb 25 '10 at 10:11
1  
That example is incorrect. That example will fire off at midnight of the 20th day of the month, NOT at 20:00 every day. –  Magellan Jul 24 '12 at 4:01
    
Corrected, thanks. –  DaDaDom Jul 24 '12 at 20:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.