2016-10-28 00:36:26 +00:00
|
|
|
---
|
2020-02-06 23:45:31 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: 'Commands: job init'
|
|
|
|
sidebar_title: init
|
|
|
|
description: |
|
2018-03-22 17:56:06 +00:00
|
|
|
The job init command is used to generate a skeleton jobspec template.
|
2016-10-28 00:36:26 +00:00
|
|
|
---
|
|
|
|
|
2018-03-22 17:56:06 +00:00
|
|
|
# Command: job init
|
2019-10-22 13:44:00 +00:00
|
|
|
|
2018-03-22 18:09:26 +00:00
|
|
|
**Alias: `nomad init`**
|
2016-10-28 00:36:26 +00:00
|
|
|
|
2018-03-22 17:56:06 +00:00
|
|
|
The `job init` command creates an example [job specification][jobspec] in the
|
2016-10-28 00:36:26 +00:00
|
|
|
current directory that demonstrates some common configurations for tasks, task
|
|
|
|
groups, runtime constraints, and resource allocation.
|
|
|
|
|
2019-10-22 13:44:00 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
```plaintext
|
2019-12-19 19:59:12 +00:00
|
|
|
nomad job init [options] [filename]
|
2019-10-22 13:44:00 +00:00
|
|
|
```
|
2016-10-28 00:36:26 +00:00
|
|
|
|
2019-12-19 19:59:12 +00:00
|
|
|
You may optionally supply a filename for the example job to be written to. The
|
|
|
|
default filename for the generated file is "example.nomad".
|
|
|
|
|
|
|
|
Please refer to the [jobspec] and [drivers] pages to learn how to customize the
|
|
|
|
template.
|
|
|
|
|
2018-05-10 17:15:57 +00:00
|
|
|
## Init Options
|
|
|
|
|
2019-10-22 13:44:00 +00:00
|
|
|
- `-short`: If set, a minimal jobspec without comments is emitted.
|
|
|
|
- `-connect`: If set, the jobspec includes Consul Connect integration.
|
2018-05-10 17:15:57 +00:00
|
|
|
|
2016-10-28 00:36:26 +00:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
Generate an example job file:
|
|
|
|
|
2020-05-18 20:53:06 +00:00
|
|
|
```shell-session
|
|
|
|
$ nomad job init
|
2016-10-28 00:36:26 +00:00
|
|
|
Example job file written to example.nomad
|
|
|
|
```
|
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
[jobspec]: /docs/job-specification 'Nomad Job Specification'
|
|
|
|
[drivers]: /docs/drivers 'Nomad Task Drivers documentation'
|