Scheduling using CRON (Templates)
All of the data integration processes that are created through the use of the integration templates can be executed on a standard schedule through a CRON (Common Run On) job.
What is CRON?
The cron command-line utility, also known as CRON job, is a job scheduler process for all Unix-like operating systems. Through the Pricefx Integration Templates, users can set up and maintain a scheduling process using cron to schedule our integration inbound and outbound jobs to run periodically at fixed times, dates, or intervals.
CRON and Integration Template Scheduling
When we are configuring the use of our Integration Templates, within the Integration Properties supporting the route we are building, there will be an option to configure the CRON schedule:
You will notice that it is a text entry that is used to configure the parameters for the cron job execution and the layout can be interpreted as follows:
NOTE: each line in the configuration can contain up to six different fields, but we can use combinations of these to define when and how often it will run.
CRON Parameters
These five fields (time and date) also accept the following operators:
*
The asterisk operator (which is default with IM routes) means all allowed values. If you have the asterisk symbol in the Minute field, it means the task will be performed each minute.-
The hyphen operator will allow us to specify a range of designated values. If you set1-5
in the Day of the week field, the task will run every weekday (From Monday to Friday). The range is deemed to be inclusive, which means that the first and last values are included in the range.,
The comma will allow us to define a list of values for repetition. For example, if you have1,3,5
in the Hour field, the task will run at 1 am, 3 am and 5 am. The list can contain single values and ranges,1-5,7,8,10-15
/
The slash operator will allow us to specify step values that can be used in conjunction with ranges. For example, if you have1-10/2
in the Minutes field, it means the action will be performed every two minutes in range 1-10 minutes. This could be considered the same as specifying1,3,5,7,9
.
NOTE: Instead of a range of values, you can also use the asterisk operator. To specify a job to be run every 20 minutes, you can use “*/20”.
Run CRON Job Every 5 Minutes
There are two ways to run a cron job every five minutes. First option is to use the comma operator a create a list of minutes:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * command
Copy
NOTE: The line above is syntactically correct and it will work just fine. However, typing the whole list can be tedious and prone to errors.
The second option to specify a job to be run every 5 minutes hours is to use the step operator:
*/5 * * * * command
Copy
More CRON Examples
Below are some additional examples of cron strings related to scheduling:
Minutes | Hours | Day of Month | Month | Day of week | Year | Description |
---|---|---|---|---|---|---|
0 | 10 | * | * | ? | * | Run at 10:00 am (UTC) every day |
15 | 12 | * | * | ? | * | Run at 12:15 pm (UTC) every day |
0 | 18 | ? | * | MON-FRI | * | Run at 6:00 pm (UTC) every Monday through Friday |
0 | 8 | 1 | * | ? | * | Run at 8:00 am (UTC) every 1st day of the month |
0/15 | * | * | * | ? | * | Run every 15 minutes |
0/10 | * | ? | * | MON-FRI | * | Run every 10 minutes Monday through Friday |
0/5 | 8-17 | ? | * | MON-FRI | * | Run every 5 minutes Monday through Friday between 8:00 am and 5:55 pm (UTC) |
CRON Restrictions
There are several restrictions when it comes to CRON expressions:
We are not allowed to specify the Day-of-month and Day-of-week fields in the same cron expression. If you specify a value (or a *) in one of the fields, you must use a ? (question mark) in the other.
Any cron expressions that lead to rates faster than 1 minute are not supported.