Skip to content

Commit c6db174

Browse files
authored
Merge pull request #25078 from shekhar-rajak/92636_cron_syntax
Add basic cron syntax in documentation
2 parents 7acb137 + df69d3c commit c6db174

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

content/en/docs/concepts/workloads/controllers/cron-jobs.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,37 @@ This example CronJob manifest prints the current time and a hello message every
4949
([Running Automated Tasks with a CronJob](/docs/tasks/job/automated-tasks-with-cron-jobs/)
5050
takes you through this example in more detail).
5151

52+
### Cron schedule syntax
53+
54+
```
55+
# ┌───────────── minute (0 - 59)
56+
# │ ┌───────────── hour (0 - 23)
57+
# │ │ ┌───────────── day of the month (1 - 31)
58+
# │ │ │ ┌───────────── month (1 - 12)
59+
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
60+
# │ │ │ │ │ 7 is also Sunday on some systems)
61+
# │ │ │ │ │
62+
# │ │ │ │ │
63+
# * * * * *
64+
```
65+
66+
67+
| Entry | Description | Equivalent to |
68+
| ------------- | ------------- |------------- |
69+
| @yearly (or @annually) | Run once a year at midnight of 1 January | 0 0 1 1 * |
70+
| @monthly | Run once a month at midnight of the first day of the month | 0 0 1 * * |
71+
| @weekly | Run once a week at midnight on Sunday morning | 0 0 * * 0 |
72+
| @daily (or @midnight) | Run once a day at midnight | 0 0 * * * |
73+
| @hourly | Run once an hour at the beginning of the hour | 0 * * * * |
74+
75+
76+
77+
For example, the line below states that the task must be started every Friday at midnight, as well as on the 13th of each month at midnight:
78+
79+
`0 0 13 * 5`
80+
81+
To generate CronJob schedule expressions, you can also use web tools like [crontab.guru](https://crontab.guru/).
82+
5283
## CronJob limitations {#cron-job-limitations}
5384

5485
A cron job creates a job object _about_ once per execution time of its schedule. We say "about" because there

0 commit comments

Comments
 (0)