open-nomad/website/content/docs/commands/alloc/restart.mdx
Isabel Suchanek 13db600665
cli: add -task flag to alloc signal, restart (#10859)
Alloc exec only works when task is passed as a flag and not an arg.
Alloc logs currently accepts either, but alloc signal and restart only
accept task as an arg. This adds -task as a flag to the other alloc
commands to make the cli UX consistent. If task is passed as a flag and
an arg, it ignores the arg.
2021-07-07 09:58:16 -07:00

64 lines
1.5 KiB
Plaintext

---
layout: docs
page_title: 'Commands: alloc restart'
description: |
Restart a running allocation or task
---
# Command: alloc restart
The `alloc restart` command allows a user to perform an in place restart of an
an entire allocation or individual task.
## Usage
```plaintext
nomad alloc restart [options] <allocation> <task>
```
This command accepts a single allocation ID and a task name. The task name must
be part of the allocation and the task must be currently running. The task name
is optional and if omitted every task in the allocation will be restarted.
Task name may also be specified using the `-task` option rather than a command
argument. If task name is given with both an argument and the `-task` option,
preference is given to the `-task` option.
When ACLs are enabled, this command requires a token with the
`alloc-lifecycle`, `read-job`, and `list-jobs` capabilities for the
allocation's namespace.
## General Options
@include 'general_options.mdx'
## Restart Options
- `-task`: Specify the individual task to restart.
- `-verbose`: Display verbose output.
## Examples
```shell-session
$ nomad alloc restart eb17e557
$ nomad alloc restart eb17e557 foo
Could not find task named: foo, found:
* test
<blocking>
```
Specifying task name with the `-task` option:
```shell-session
$ nomad alloc restart -task redis eb17e557
```
If task name is specified using both options, the command argument is ignored.
The following will restart the "redis" task only, not the "api" task:
```shell-session
$ nomad alloc restart -task redis eb17e557 api
```