github.com/zhizhiboom/nomad@v0.8.5-0.20180907175415-f28fd3a1a056/website/source/docs/job-specification/periodic.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "periodic Stanza - Job Specification" 4 sidebar_current: "docs-job-specification-periodic" 5 description: |- 6 The "periodic" stanza allows a job to run at fixed times, dates, or intervals. 7 The easiest way to think about the periodic scheduler is "Nomad cron" or 8 "distributed cron". 9 --- 10 11 # `periodic` Stanza 12 13 <table class="table table-bordered table-striped"> 14 <tr> 15 <th width="120">Placement</th> 16 <td> 17 <code>job -> **periodic**</code> 18 </td> 19 </tr> 20 </table> 21 22 The `periodic` stanza allows a job to run at fixed times, dates, or intervals. 23 The easiest way to think about the periodic scheduler is "Nomad cron" or 24 "distributed cron". 25 26 ```hcl 27 job "docs" { 28 periodic { 29 cron = "*/15 * * * * *" 30 prohibit_overlap = true 31 } 32 } 33 ``` 34 35 The periodic expression by default evaluates in the **UTC timezone** to ensure 36 consistent evaluation when Nomad spans multiple time zones. 37 38 ## `periodic` Requirements 39 40 - The job's [scheduler type][batch-type] must be `batch`. 41 - A job can not be updated to be periodically. Thus, to transition an existing job to be periodic, you must first run `nomad stop -purge «job name»`. This is expected behavior and is to ensure that this change has been intentionally made by an operator. 42 43 ## `periodic` Parameters 44 45 - `cron` `(string: <required>)` - Specifies a cron expression configuring the 46 interval to launch the job. In addition to [cron-specific formats][cron], this 47 option also includes predefined expressions such as `@daily` or `@weekly`. 48 49 - `prohibit_overlap` `(bool: false)` - Specifies if this job should wait until 50 previous instances of this job have completed. This only applies to this job; 51 it does not prevent other periodic jobs from running at the same time. 52 53 - `time_zone` `(string: "UTC")` - Specifies the time zone to evaluate the next 54 launch interval against. This is useful when wanting to account for day light 55 savings in various time zones. The time zone must be parsable by Golang's 56 [LoadLocation](https://golang.org/pkg/time/#LoadLocation). 57 58 ## `periodic` Examples 59 60 The following examples only show the `periodic` stanzas. Remember that the 61 `periodic` stanza is only valid in the placements listed above. 62 63 ### Run Daily 64 65 This example shows running a periodic job daily: 66 67 ```hcl 68 periodic { 69 cron = "@daily" 70 } 71 ``` 72 73 ### Set Time Zone 74 75 This example shows setting a time zone for the periodic job to evaluate in: 76 77 ```hcl 78 periodic { 79 cron = "*/15 * * * * *" 80 time_zone = "America/New_York" 81 } 82 ``` 83 84 [batch-type]: /docs/job-specification/job.html#type "Batch scheduler type" 85 [cron]: https://github.com/gorhill/cronexpr#implementation "List of cron expressions"