Commands icon
Process icon

Run a Shell script as a subprocess on the Kestra host

Run Shell scripts as a subprocess on the Kestra host with the Process task runner. Execute system commands and CLI tools directly inside orchestrated workflows.

Categories
Data
id: process-script-runner
namespace: company.team

tasks:
  - id: shell
    type: io.kestra.plugin.scripts.shell.Commands
    taskRunner:
      type: io.kestra.plugin.core.runner.Process
    commands:
      - echo "Hello World!"

Run arbitrary Shell commands as a child process on the Kestra host with the io.kestra.plugin.scripts.shell.Commands task and the io.kestra.plugin.core.runner.Process task runner. This blueprint solves the simplest possible script execution problem: you have shell commands, CLI tools, or system utilities already installed on the Kestra host and you want to run them inside an orchestrated workflow without spinning up a container, a remote VM, or a Kubernetes pod. The Process task runner executes the command in the same environment as the Kestra worker, so it starts instantly and inherits the host PATH, binaries, and environment variables.

How it works

  1. The shell task of type io.kestra.plugin.scripts.shell.Commands defines the commands to run.
  2. Its taskRunner is set to io.kestra.plugin.core.runner.Process, which launches the script as a subprocess of the Kestra worker rather than in an isolated container.
  3. The commands list holds the shell statements to execute (here a single echo "Hello World!"), running sequentially in the host shell.

What you get

  • Instant, zero-overhead script execution with no container pull or VM boot.
  • Full access to binaries, CLI tools, and environment variables already on the Kestra host.
  • Captured stdout, stderr, and exit codes surfaced in the Kestra UI.
  • A minimal, copy-paste starting point for any shell-based automation.

Who it's for

  • Data and platform engineers wrapping existing shell scripts in orchestration.
  • DevOps teams running system utilities, file operations, or CLI calls on a trusted host.
  • Anyone prototyping a workflow before moving to containerized task runners.

Why orchestrate this with Kestra

A bare shell script run by cron gives you no visibility and no recovery. With Kestra you get event and schedule triggers, automatic retries, full execution logs, output capture, and lineage across tasks, all defined in declarative YAML. The Process runner keeps execution lightweight while you gain the scheduling, observability, and error handling that a plain shell prompt or a crontab entry simply cannot provide.

Prerequisites

  • A running Kestra instance.
  • The commands or binaries you invoke must already be installed on the Kestra host, since the Process runner uses the host environment.

Secrets

This blueprint references no secrets. To inject credentials, add them as environment variables or reference them with {{ secret('NAME') }}.

Quick start

  1. Copy this blueprint into a new flow in the Kestra UI.
  2. Replace the echo "Hello World!" command with your own shell statements.
  3. Execute the flow and inspect the logs and outputs in the Executions view.

How to extend

  • Add more entries to commands to chain multiple shell steps.
  • Pass values in with flow inputs and reference them via Pebble expressions.
  • Capture files with outputFiles to pass artifacts to downstream tasks.
  • Swap the Process runner for io.kestra.plugin.scripts.runner.docker.Docker when you need dependency isolation.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.