Skip to content

v3.6.0

Choose a tag to compare

@github-actions github-actions released this 28 Jul 21:40
· 1 commit to master since this release

v3.6.0

Date: 2026-07-28
Previous release: v3.5.1

Summary

Adds exec command for non-interactive command execution on one or more
devices.

Highlights

  • exec command: Execute shell commands on devices non-interactively,
    capturing output and exit codes. Unlike terminal, exec runs a command
    (or chained commands), captures the output, and returns.
  • Multi-device support: Target multiple devices using the same flexible
    options as deployments create: --device (repeatable), --filter-multi,
    --group, or --all.
  • Sequential execution: Devices are processed one at a time with
    per-device output blocks and a summary at the end.
  • Confirmation dialog: Shows target count before executing. Use --yes
    to skip for automation.
  • Timeout control: Per-device timeout with --timeout (default 60s).
  • Dry-run mode: Use --dry-run to preview targeted devices without
    executing.
  • JSON output: Use --raw for machine-readable JSON output.

Example Usage

# Execute on a single device by ID
mender-cli exec --command 'hostname' --device abc123

# Execute on a device matching a filter
mender-cli exec --command 'uptime' -f hostname=my-gateway

# Execute on all devices in a group
mender-cli exec --command 'cat /etc/os-release' --group production

# Execute on all devices matching a filter (multi-device)
mender-cli exec --command 'df -h' --filter-multi device_type=gateway

# Execute on all accepted devices
mender-cli exec --command 'date' --all --yes

# Chained commands (use && to proceed only if previous succeeds)
mender-cli exec --command 'apt update && apt upgrade -y' --group staging --timeout 5m

# Dry run to preview targets
mender-cli exec --command 'hostname' --group production --dry-run

# JSON output for scripting
mender-cli exec --command 'hostname' --device abc123 --yes --raw

Notes

  • Command wrapping: Commands are automatically terminated with ; exit $?
    to capture the exit code. Trailing semicolons are stripped to avoid syntax
    errors.
  • Exit codes: CLI exits 0 if all devices succeed, 1 if any fail. A summary
    table shows per-device exit codes.
  • Mutually exclusive targeting: --device, -f/--filter, --filter-multi,
    --group, and --all cannot be combined.

Upgrading

  • No breaking changes. The new exec command is purely additive.