Skip to content

Nexo Shell

The execution family: running commands and scripts on the sink host. See the overview for how every module executes and the shared parameter types.

What it does — runs a single shell command, dispatching on the host OS.

How it works

  • The command parameter holds a full command line, split into arguments with shell-style quoting: echo 'a b' passes a b as one argument. No shell interpreter is involved — pipes and redirects are literal characters, never operators (scripted needs belong in ShellScript or Powershell).
  • Every parameter beyond command is appended as exactly one argument (STATIC verbatim, DATA from the event payload) — no quoting is applied to them, so a value containing quotes arrives literally.
  • On Linux, the first token resolves like any command line: from PATH, or as an absolute path. If SCRIPTS_FOLDER is set on the sink and the bare command name exists as a file in that folder, it resolves to that file.
  • On Windows, the command line runs via cmd.exe /c. Because cmd re-parses the command string, a DATA parameter containing cmd metacharacters (& | ^ < > %, CR, LF) is rejected loudly — STATIC content is flow-author intent and allowed; use the Powershell modules for complex Windows commands.

Needs from the node — nothing declared; any sink node matches. Windows hosts use cmd.exe (present by default).

Parameters

KeyType optionsMeaning
commandSTATIC (usual) or DATAThe full command line — the first parameter
(additional)STATIC or DATAAppended as one argument each, in order

What it does — executes a shell script that lives on the sink host, and nothing else.

How it works

  • The first parameter must be a bare script filename — no /, \, or .. — that exists as a file in the sink host’s SCRIPTS_FOLDER. There is no PATH fallback: echo, sh, and friends are refused.
  • The remaining parameters are passed to the script as arguments (unquoted, as subprocess arguments) — positionally, or as --key value pairs when the reserved arg_style param is named (below).
  • The script runs with ParseOutput and emits result markers itself.

Argument style — the reserved STATIC param arg_style switches the argument shape:

  • positional (default, or absent): every value appends verbatim, in param order.
  • named: the script name stays the first token; every other param renders as --<key> <value>. A STATIC value that already starts with - passes verbatim (pre-formed flags), and a DATA param with an empty payload value is skipped (no dangling --<key>).
  • The arg_style param itself never lands in the script’s arguments.

Needs from the node — SCRIPTS_FOLDER must be set on the sink service (systemd installer flag or environment variable); nothing is declared in the library’s requirements, so placement matches any sink node — a sink without the folder fails the event instead.

Parameters

KeyType optionsMeaning
scriptSTATIC or DATAThe bare script filename in SCRIPTS_FOLDER — the first parameter
(additional)STATIC or DATAPassed to the script as arguments — positional, or --key value in named style
arg_styleSTATIC — positional (default) or namedReserved: selects the argument shape; never passed to the script

What it does — free-form PowerShell execution via pwsh -Command.

How it works

  • The first parameter is the command string, executed with pwsh -Command.
  • Every further parameter becomes a $var assignment prepended to the command, so the command can reference it:
    • STATIC → assigned as a single-quoted PowerShell literal ('' doubling, no interpolation).
    • DATA → assigned base64-decoded, so the value survives every PowerShell quoting rule and arrives verbatim — hostile payloads can’t break out of the assignment.
  • The command itself may be STATIC or DATA — it is the module’s designated code-execution channel.

Needs from the node — the pwsh engine, minimum version 5.1.

Parameters

KeyType optionsMeaning
commandSTATIC or DATAThe PowerShell command string — the first parameter
(additional)STATIC or DATAExposed to the command as $var assignments, in order

What it does — executes a .ps1 script that lives on the sink host, and nothing else.

How it works

  • The first parameter must be a bare .ps1 filename (no /, \, ..) that exists in SCRIPTS_FOLDER (mandatory — no PATH fallback).
  • Every further parameter is exposed twice: as a $var assignment prepended to the invocation (STATIC literal / DATA base64-decoded, same as Powershell) and as a named argument — the script is invoked as & '<script>' -key $key ….
  • The script runs with ParseOutput and emits result markers itself.

Needs from the node — the pwsh engine, minimum version 5.1, and SCRIPTS_FOLDER set on the sink.

Parameters

KeyType optionsMeaning
scriptSTATIC or DATAThe bare .ps1 filename in SCRIPTS_FOLDER — the first parameter
(additional)STATIC or DATAExposed as $var and passed as -key $key named arguments

What it does — executes a Windows batch script (.bat / .cmd) that lives on the sink host, and nothing else.

How it works

  • The first parameter must be a bare .bat/.cmd filename (no /, \, ..) that exists in SCRIPTS_FOLDER (mandatory — no PATH fallback; the extension is enforced).
  • Further parameters are delivered positionally — the script receives them as %1 %2 …. Runtime argument quoting applies, and substitution happens after cmd has parsed the line, so payload characters are not re-parsed by cmd.
  • The script runs with ParseOutput and emits result markers itself.

Needs from the node — Windows only (declared os_families: win — a Linux node never matches), and SCRIPTS_FOLDER set on the sink.

Parameters

KeyType optionsMeaning
scriptSTATIC or DATAThe bare .bat/.cmd filename in SCRIPTS_FOLDER — the first parameter
(additional)STATIC or DATAPositional arguments — the script reads them as %1 %2 …