I'm running my Jobs using Quartz with a cron expression every 50 seconds:
Cron_Expression = "0/50 * * * * ?"
What happens is that my job runs at the seconds: 50, 60, 50, 60,... and not every 50 seconds! and does not run at the second "0".
What is the right cron expression every 50 seconds starting at 0?
* * * * * is a cron schedule expression wildcard, meaning your cron job should run every minute of every hour of every day of every month, each day of the week.
*/5 * * * * Execute a cron job every 5 minutes. 0 * * * * Execute a cron job every hour.
The cron triggers you can configure in the Orchestration Server Job Scheduler use a Quartz crontrigger class for deciding when to invoke job execution. This is based on the standard Quartz format that you can find further described on the KickJava website.
quartz. Trigger. A cron expression is a string consisting of six or seven subexpressions (fields) that describe individual details of the schedule. These fields, separated by white space, can contain any of the allowed values with various combinations of the allowed characters for that field.
The '/' syntax specifies the increment during the period and not a repeat interval. Admittedly a subtle and confusing difference.
In this case there is only one available increment (50 seconds) during the 1 minute period. The first number specifies the value to start with, in this case 0. Specifying '*' before the '/' is equivalent to specifying 0. So the job will only fire on the minute (0 and 60 are interchangeable) and at 50 seconds.
If the period can be divided by multiple increments, eg 0/10 then it will fire for each at each of those times, eg at 10, 20, 30 etc seconds.
If you want a job to trigger at a regular interval then you can use a Quartz SimpleTrigger
with a repeatInterval
specified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With