Cloud Workflow presents a scheduler that allows automating the execution of a task over time. The corresponding schedule can be defined via a menu, where the user selects the necessary time expression or via a CRON expression.
This article explains what a CRON expression is, and how to create a valid one for Cloud Workflow.
What is CRON
CRON is a time-based software utility, usually available in Unix-like machines, which can be used to schedule the execution of computer tasks.
The Unix version of CRON uses a file named crontab, where all automated tasks are listed, accompanied by a time tag, which defines the execution rule.
Advantages of using a CRON expression
Although not always so evident, CRON expressions can be beneficial when defining repetitive tasks. The syntax is straightforward and gives the user a good command over the automation of tasks.
Even easier, the Cloud Workflow’s Scheduler uses only the time section of a CRON expression.
How to add a CRON expression in Cloud Workflow
Adding a CRON expression in Cloud Workflow is straightforward. From the Repeat menu present in the Scheduler, select CRON and then add your CRON expression in the CRON Expression text box.
The diagram below summarizes the time section of a CRON expression.
As the reader can see, the time section of a CRON expression consists of five fields, representing minutes, hours, day of the month, month, and day of the week, in that order.
The possible values for each field are defined in the figure above — a star or asterisk (*) represents all possible values.
Some examples of the time section of a CRON expression are:
1 0 * * *
With indicates the first minute, of the first hour, of every day, of every month, of every day of the week.
1 0 1 * *
The above expression has added 1 to the day of the month field. Thus, it indicates the first minute, of the first hour, of the very first day of each month.
1 0 1 1 *
The above expression has added 1 to the month field. Thus, it indicates the 1st minute, of the first hour, of the 1st of January.
1 0 1 1 6
The above expression has added 6 to the day of the week field. Thus, it indicates the 1st minute, of the first hour, of the 1st of January, which must be Saturday.
It should be noticed that the Scheduler accepts standard CRON expressions. Non-standard CRON commands, such as @yearly, are not considered.
To learn more, please visit our site – DBSync