be04bfed34
* Clean up handling of subprocesses and make using a shell optional * Update docs for subprocess changes * Fix tests for new subprocess behavior * More cleanup of subprocesses * Minor adjustments and cleanup for subprocess logic * Makes the watch handler reload test use the new path. * Adds check tests for new args path, and updates existing tests to use new path. * Adds support for script args in Docker checks. * Fixes the sanitize unit test. * Adds panic for unknown watch type, and reverts back to Run(). * Adds shell option back to consul lock command. * Adds shell option back to consul exec command. * Adds shell back into consul watch command. * Refactors signal forwarding and makes Windows-friendly. * Adds a clarifying comment. * Changes error wording to a warning. * Scopes signals to interrupt and kill. This avoids us trying to send SIGCHILD to the dead process. * Adds an error for shell=false for consul exec. * Adds notes about the deprecated script and handler fields. * De-nests an if statement.
58 lines
2.1 KiB
Plaintext
58 lines
2.1 KiB
Plaintext
---
|
|
layout: "docs"
|
|
page_title: "Commands: Watch"
|
|
sidebar_current: "docs-commands-watch"
|
|
description: |-
|
|
The `watch` command provides a mechanism to watch for changes in a particular data view (list of nodes, service members, key value, etc) and to invoke a process with the latest values of the view. If no process is specified, the current values are dumped to stdout which can be a useful way to inspect data in Consul.
|
|
---
|
|
|
|
# Consul Watch
|
|
|
|
Command: `consul watch`
|
|
|
|
The `watch` command provides a mechanism to watch for changes in a particular
|
|
data view (list of nodes, service members, key value, etc) and to invoke
|
|
a process with the latest values of the view. If no process is specified,
|
|
the current values are dumped to STDOUT which can be a useful way to inspect
|
|
data in Consul.
|
|
|
|
There is more [documentation on watches here](/docs/agent/watches.html).
|
|
|
|
## Usage
|
|
|
|
Usage: `consul watch [options] [child...]`
|
|
|
|
The only required option is `-type` which specifies the particular
|
|
data view. Depending on the type, various options may be required
|
|
or optionally provided. There is more documentation on watch
|
|
[specifications here](/docs/agent/watches.html).
|
|
|
|
#### API Options
|
|
|
|
<%= partial "docs/commands/http_api_options_client" %>
|
|
<%= partial "docs/commands/http_api_options_server" %>
|
|
|
|
#### Command Options
|
|
|
|
* `-key` - Key to watch. Only for `key` type.
|
|
|
|
* `-name`- Event name to watch. Only for `event` type.
|
|
|
|
* `-passingonly=[true|false]` - Should only passing entries be returned. Defaults to
|
|
`false` and only applies for `service` type.
|
|
|
|
* `-prefix` - Key prefix to watch. Only for `keyprefix` type.
|
|
|
|
* `-service` - Service to watch. Required for `service` type, optional for `checks` type.
|
|
|
|
* `-shell` - Optional, use a shell to run the command (can set a custom shell via the
|
|
SHELL environment variable). The default value is true.
|
|
|
|
* `-state` - Check state to filter on. Optional for `checks` type.
|
|
|
|
* `-tag` - Service tag to filter on. Optional for `service` type.
|
|
|
|
* `-type` - Watch type. Required, one of "`key`, `keyprefix`, `services`,
|
|
`nodes`, `service`, `checks`, or `event`.
|
|
|