# Crontab Syntax

The scheduled tasks will run when the specified values for minute, hour, and month match the current time and date, and at least one of the two-day fields (day of month or day of week) matches the current date.

Refer to the below crontab syntax to define the schedule parameter. It consists of five time and date fields separated by at least one space. Ensure that there are no spaces within a field value.&#x20;

## Crontab Syntax

{% code title="Crontab Syntax" %}

```
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of the week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of month (1 - 31)
|     +----------- hour (0 - 23)
+------------- minute (0 - 59)
```

{% endcode %}

## **Format Values**

<table><thead><tr><th width="172">Field</th><th>Allowed Values</th></tr></thead><tbody><tr><td>minute</td><td>0-59</td></tr><tr><td>hour</td><td>0-23</td></tr><tr><td>day of month</td><td>1-31</td></tr><tr><td>month</td><td><p>i. 1-12, where 1 is January, 2 is February, and so on.</p><p>ii. Uppercase lowercase and mixed-case three-character strings based on the English name of the month. For example: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, or dec.</p></td></tr><tr><td>day of week</td><td><p>i. 0-7, where 0 or 7 is Sunday, 1 is Monday, and so on.</p><p>i. Uppercase and lowercase or mixed-case three-character strings based on the English name of the day: mon, tue, wed, thu, fri, sat, or sun.</p></td></tr></tbody></table>

## Ranges and Lists

You can specify ranges of numbers in the cron format. A range is represented by two numbers separated by a hyphen (-). The specified range is inclusive, meaning both the start and end values are included. For example, if you enter 9-12 for the hour field, it will execute the task at hours 9, 10, 11, and 12.

Additionally, cron supports lists of values or ranges. A list is a set of single numbers or ranges separated by commas (,).

## Unrestricted Range <a href="#d64890e289" id="d64890e289"></a>

You can use an asterisk (\*) in any field to represent all possible values for that field.

The day on which a command will execute can be specified using two fields: 'day of month' and 'day of week'. If you provide a specific value (other than the asterisk) for both these fields, the command will run when either field matches the current date. For example, the cron expression '20 2 1,15 \* 5' will execute the command at 2:20 AM on the 1st and 15th of every month and every Friday.

## Step Values

You can use step values along with ranges in the cron format. The syntax `range/step` allows you to define a range and specify an execution interval within that range.

If you use `first-last/step`, the command will execute at the `first` value, and then at all successive values that are a distance of `step` away from `first`, until the `last` value is reached.

For example, to execute a command every other hour, you can use `0-25/2`. This expression is equivalent to `0,2,4,6,8,10,12,14,16,18,20,22,24`.

Alternatively, if you specify `*/step`, the command will execute at every interval of `step` across the entire range of possible values for that field. So, instead of `0-23/2` for executing every other hour, you can use `*/2`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://how.router.works/dev/ssh/cron.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
