Skip to main content

Execute a shell command

POST 

/command/shell

Execute a command through /bin/sh -c. Supports shell features like pipes, redirects, and variable expansion.

Request

Query Parameters

    target_hostname string

    Default value: _any

    Target: _any (load-balanced), _all (broadcast), hostname (direct), or key:value (label group, e.g., group:web.dev).

Body

required

The shell command to execute.

    command stringrequired

    The full shell command string.

    cwd string

    Working directory for the command.

    timeout integer

    Possible values: >= 1 and <= 300

    Default value: 30

    Timeout in seconds (default 30, max 300).

Responses

Shell command execution accepted.

Schema

    job_id uuid

    The job ID used to process this request.

    results

    object[]

    required

  • Array [

  • hostname stringrequired

    The hostname of the agent that executed the command.

    stdout string

    Standard output of the command.

    stderr string

    Standard error output of the command.

    exit_code integer

    Exit code of the command.

    duration_ms int64

    Execution time in milliseconds.

    changed boolean

    Whether the command modified system state.

    error string

    Error message if the agent failed to process the request.

  • ]

Loading...