Support articles
Find clear, step-by-step solutions to common WithSecure issues across installation, configuration, updates, and product performance.
What CRON expression to use on Elements Endpoint Protection Automated Task ?
Last updated
Issue:
How to create a specific CRON expression for Elements Endpoint Protection Automated Tasks feature. I what format should the CRON expression be in the schedule field?
Resolution:
Below you will find a detailed explanation of the format of schedule expressions. A CRON expression is a string composed of four fields (separated by white spaces) that represent a time schedule.
The general form is as follows:
<hours> <days of month> <months> <days of week>
| Field | Allowed value | Allowed special characters |
|---|---|---|
| hours | 0-23 | * , - # |
| days of month | 1-31 | * , - ? # |
| months | 1-12 | * , - # |
| days of week | 0-6 | * , - ? # |
| Special characters | |
|---|---|
* |
(all values) |
| Select all values within a field. | |
? |
(no specific value) |
| Specify one field and leave the other unspecified. | |
- |
(range) |
| Specify ranges. | |
, |
(comma) |
| Specify additional values. | |
/ |
(slash) |
| Specify increments. | |
# |
(random value) |
| Specify the random value.You can select values to choose a random value from. Forexample: #9-17 selects a random value between 9 and 17, #1,5-8,10 selects a random value from 1, 5, 6, 7, 8, 10. |
|
| Examples of CRON macros expressions |
|---|
@hourly |
Run the task every hour at a random time. Equals to # # * * * * |
@daily |
Run the task every day at a random time. Equals to # # # * * * |
@daily <hours> |
Run the task every day at specified hour. Equals to # # <hours> * * *.For example, @daily #9-17 equals to # # #9-17 * * * |
@weekdays |
Run the task every working day at a random time. Equals to # # # ? * 1-5 |
@weekdays <hours> |
Run the task every working day at specified time. Equals to # # <hours> ? * 1-5.For example, @weekdays #9-17 equals to # # #9-17 ? * 1-5 |
@weekends |
Run the task every Saturday and Sunday at a random time. Equals to # # # ? * 0,6 |
@weekends <hours> |
Run the task every Saturday and Sunday at specified time. Equals to # # <hours> ? * 0,6.For example, @weekends #9-17 equals to # # #9-17 ? * 0,6 |
@weekly |
Run the task every week at a random time. Equals to # # # * * # |
@weekly <hours> <day of week> |
Run the task every week at specified time and day. Equals to # # <hours> * * <day of week>.For example, @weekly #9-17 #1-5 equals to # # #9-17 * * #1-5 |
@monthly |
Run the task every month at a random time. Equals to # # # # * * |
@midnight |
Run the task every time at a random time near the midnight. Equals to # # 0 * * * |
@once |
| The task will be executed once as soon as possible. |
@reboot |
| The task will be executed on every reboot. |
@on_software_changed |
| The task will be executed every time when a software was installed, updated or removed. |
@lock |
| The task will be executed every time when user locks a workstation. |
@away |
| The task will be executed every time when user is away from the workstation for the given amount of minutes. |
| Examples of CRON expressions | |
|---|---|
#9-17 * * 1-5 |
|
| Run the task every working day at random time between 9 AM and 6 PM | |
#9-17 ? * #1-5 |
|
| Run the task every week on random working day at random time between 9 AM and 6 PM | |
15 ? * #2,4 |
|
| Run the task every week either on Tuesday or on Thursday at a random time between 3 PM and 4 PM | |
12 * * * |
|
| Run the task at a random time between 12 PM and 13 PM | |
12 1/5 * ? |
|
| At a random time between 12 PM and 1 PM every five days each month, starting on the first day of the month | |
10 ? * 1-5 |
|
| At a random time between 10 AM and 11 AM every Monday, Tuesday, Wednesday, Thursday and Friday | |
*/2 * * ? |
|
| Every 2 hours at a random time within this hour | |
*/4 ? */6 */2 |
|
| At a random time within one hour every 4 hours, every other day, every 6 months | |
14 * * ? |
|
| Randomly every 5 minutes between 2 PM and 3 PM every day | |
14 ? 3 3 |
|
| At a random time between 2 PM and 3 PM every Wednesday of March | |
13 12 11 ? |
|
| Every November 12th at a random time between 13 PM and 14 PM | |
Important: The same task cannot be executed more than once an hour, even if the task is specified to run more often.Use randomization (#) to prevent overloading the network.The accuracy of the task execution is always rounded up to an hour.