From df69d3c35448a7a3a186a7960f7991523df6d0f1 Mon Sep 17 00:00:00 2001 From: Shekhar Prasad Rajak Date: Thu, 26 Nov 2020 12:09:55 +0530 Subject: [PATCH] Cron schedule syntax and examples added removed the reboot entry, since it is non standard scheudle syntax and not related to cron syntax for scheduling --- .../workloads/controllers/cron-jobs.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/content/en/docs/concepts/workloads/controllers/cron-jobs.md b/content/en/docs/concepts/workloads/controllers/cron-jobs.md index af12bcba25..8e5b9fb4e3 100644 --- a/content/en/docs/concepts/workloads/controllers/cron-jobs.md +++ b/content/en/docs/concepts/workloads/controllers/cron-jobs.md @@ -51,6 +51,37 @@ This example CronJob manifest prints the current time and a hello message every ([Running Automated Tasks with a CronJob](/docs/tasks/job/automated-tasks-with-cron-jobs/) takes you through this example in more detail). +### Cron schedule syntax + +``` +# ┌───────────── minute (0 - 59) +# │ ┌───────────── hour (0 - 23) +# │ │ ┌───────────── day of the month (1 - 31) +# │ │ │ ┌───────────── month (1 - 12) +# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; +# │ │ │ │ │ 7 is also Sunday on some systems) +# │ │ │ │ │ +# │ │ │ │ │ +# * * * * * +``` + + +| Entry | Description | Equivalent to | +| ------------- | ------------- |------------- | +| @yearly (or @annually) | Run once a year at midnight of 1 January | 0 0 1 1 * | +| @monthly | Run once a month at midnight of the first day of the month | 0 0 1 * * | +| @weekly | Run once a week at midnight on Sunday morning | 0 0 * * 0 | +| @daily (or @midnight) | Run once a day at midnight | 0 0 * * * | +| @hourly | Run once an hour at the beginning of the hour | 0 * * * * | + + + +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: + +`0 0 13 * 5` + +To generate CronJob schedule expressions, you can also use web tools like [crontab.guru](https://crontab.guru/). + ## CronJob limitations {#cron-job-limitations} A cron job creates a job object _about_ once per execution time of its schedule. We say "about" because there