Using cron4j, one can set up a job to run in some time in a future
Scheduler s = new Scheduler();
s.schedule("5 10 * * *", job);
s.start();
Using cron4j, can the job be scheduled to start "next Saturday", or on "12/21/2012"?
Using cron4j, one can set up a job to run in some time in a future
Scheduler s = new Scheduler();
s.schedule("5 10 * * *", job);
s.start();
Using cron4j, can the job be scheduled to start "next Saturday", or on "12/21/2012"?
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
This is the basic break down of the command structure. starting something one the 21 would look like
0 0 21 12 *
But this would only run on the 21 of the 12 month every year.
I'm not sure you can define the year but since the fields are minute hour day month day_of_week (year)
you should be able to at least let the job run at 12/21/2012 using this expression: 0 0 21 12 ? 2012
.
Edit: cron4j doesn't seem to support the optional year expression, so it seems you can just define 0 0 21 12 *
and have the job run every December 21st.
Yes. For example:
0 0 21 12 *
This says run this at 12:00 AM on December 21st.
The Chron syntax does not finitely support a year setting, but if you set this job today, it would run the next time it crosses that date.
Note: The other answer suggests adding a year column. If you do include this, the behavior is not entirely predictable -- it depends which chron implementation you're using.