Note that there are some explanatory texts on larger screens.

plurals
  1. PORun Quartz Scheduler Job with specific start, end date and within time constraints
    primarykey
    data
    text
    <p>I am using Quartz-Scheduler for repetitive tasks but I am facing a trouble. In my server side my user wants to specify some date range like <strong>From</strong> <code>2013-09-27</code> <strong>with in</strong> <code>09:00 AM - 12:00 PM</code> <strong>to</strong> <code>2013-09-30</code></p> <blockquote> <p>Explanation:</p> </blockquote> <p>Run a job from <code>2013-09-27</code> to <code>2013-09-30</code> but only between <code>09:00 AM - 12:00 PM</code></p> <p>I am facing trouble in writing a Cron expression for it, furthermore my user is non-technical so my user wants me to create Cron expression automatically from both time stamp values. </p> <p>Please help me out. Let me know if there is another way.</p> <p>I have seen many resources on Google but I still can't find nothing.</p> <p>Links:</p> <p><a href="http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger" rel="nofollow noreferrer">http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger</a></p> <p><a href="http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-05" rel="nofollow noreferrer">http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-05</a></p> <p><a href="https://stackoverflow.com/questions/704927/does-cron-expression-in-unix-linux-allow-specifying-exact-start-and-end-dates">Does cron expression in unix/linux allow specifying exact start and end dates</a></p> <p><strong>Update</strong></p> <p>I have written one but it's not working</p> <pre><code>|------------------------------------------------------------------| | Seconds | Minutes | Hours | DayOfMonth | Month | DayOfWeek | Year| | | | | | | | | | 0 | 0 | 9-12 | 27-30 | 9 | ? | 2013| |------------------------------------------------------------------| </code></pre> <p>trying to map <code>2013-09-27</code> to <code>2013-09-30</code> but only between <code>09:00 AM - 12:00 PM</code></p> <p><strong>Updated</strong> I have also tried it running with </p> <pre><code>Trigger trigger = TriggerBuilder.newTrigger().withIdentity(NAME_TRIGGER_TASK_UPDATER, GROUP_TASK_TRIGGER) .withSchedule(CronScheduleBuilder.cronSchedule("0 0 9-12 19-22 10 ? *")).build(); </code></pre> <p>but it doesn't give any error nor go into my execute method of my job</p> <pre><code>cronSchedule("0 0 9-12 ? * ?") throws invalid schedule exception. </code></pre> <p>The code below runs it without respecting the start and end date.</p> <pre><code>String startDateStr = "2013-09-27 00:00:00.0"; String endDateStr = "2013-09-31 00:00:00.0"; Date startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").parse(startDateStr); Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").parse(endDateStr); CronTrigger cronTrigger = newTrigger() .withIdentity("trigger1", "testJob") .startAt(startDate) .withSchedule(CronScheduleBuilder.cronSchedule("0 0 9-12 * * ?")) .endAt(endDate) .build(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload