
Shell CommandsTrigger
CertifiedTrigger a flow when Shell commands match a condition
Shell CommandsTrigger
Trigger a flow when Shell commands match a condition
Polls and triggers a flow by running system commands in a shell container.
type: io.kestra.plugin.scripts.shell.CommandsTriggerExamples
Trigger when commands fail with an implicit error (exit 1).
id: commands_trigger
namespace: company.team
triggers:
- id: commands_failure
type: io.kestra.plugin.scripts.shell.CommandsTrigger
interval: PT10S
exitCondition: "exit 1"
edge: true
containerImage: ubuntu
commands:
- cat /path/that/does/not/exist
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "Triggered with exitCode={{ trigger.exitCode }} (condition={{ trigger.condition }})"
Properties
commands *array
Shell commands to execute
Commands executed on each poll (same semantics as the Shell Commands task).
exitCondition *string
Condition to match
Condition evaluated after each commands execution. The trigger emits an event only when this condition matches.
Supported forms:
- 'exit N' (example: 'exit 1'): matches when the process exit code equals N.
- Any other string: treated as a regex (or substring if regex is invalid) matched against:
- the task 'vars' (when commands emit ::{"outputs": ...}::),
- and error logs when the task fails (TaskException).
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
containerImage string
ubuntuDocker image used to execute the commands
Container image used by the underlying Commands task to run shell commands. Defaults to 'ubuntu'.
edge booleanstring
trueEdge trigger mode
If true, the trigger emits only on a transition from 'not matching' to 'matching' (anti-spam). If false, the trigger emits on every poll where the condition matches.
interval string
PT1MdurationCheck interval
Interval between polling evaluations.
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
Outputs
condition string
The captured rendered condition output
exitCode integer
The exit code of the executed commands
timestamp string
date-timeTimestamp of the event that fired the trigger
vars object
Output variables captured from the commands