TrigRun
Guides

Script Jobs

Run scheduled scripts and long-running tasks through workspace executor connections.

Script jobs let TrigRun schedule, trigger, observe, and retry command-tier work that runs in your own infrastructure. TrigRun sends the command and metadata to a workspace executor, then records stdout, stderr, exit code, output, and failures on the execution.

Use callback or poll mode for long-running tasks. In those modes TrigRun parks the execution while the executor works, then resumes it when the executor calls back or when polling reports completion.

Create an executor

Create a workspace secret first if the executor requires auth:

trigrun secrets create --name runner-token --value "runner_shared_secret"

Then register and test the executor:

trigrun executors create \
  --name production-runner \
  --base-url https://runner.example.com \
  --mode callback \
  --auth-type bearer \
  --auth-secret runner-token

trigrun executors test EXECUTOR_ID

The executor should expose:

EndpointMethodPurpose
/handshakeGETReturns supported contract versions, modes, and auth methods.
/executePOSTAccepts script execution requests from TrigRun.

Mounted volumes

If a script needs local files, mount those paths in your executor runtime. TrigRun sends the command and metadata to the executor; it does not mount host paths into TrigRun infrastructure.

For example, run the executor in your Docker, VM, or Kubernetes environment with /mnt/input and /mnt/output already mounted, then create a script job whose command references those container paths.

See Run Jobs With Mounted Volumes for a full Docker and Kubernetes example.

Create a script job

trigrun jobs create-script \
  --name nightly-report \
  --cron "0 2 * * *" \
  --executor EXECUTOR_ID \
  --executor-mode callback \
  --command "node ./scripts/report.mjs" \
  --env REPORT_TOKEN=secret://report-token \
  --timeout-ms 7200000

For a one-off run:

trigrun jobs create-script \
  --name backfill-users \
  --executor EXECUTOR_ID \
  --executor-mode poll \
  --command "node ./scripts/backfill-users.mjs" \
  --timeout-ms 7200000 \
  --run-now

timeout-ms can be up to 7200000 milliseconds. For secret-bearing env vars, the executor connection must use bearer or hmac auth.

On this page