Skip to main content
For commands that run on a schedule, see Scheduled jobs. This page covers the other kind: a command you run once and want to know finished.

One-shot jobs

A one-shot job runs a command in a fresh container built from an app’s current image, with the app’s env, secrets, volumes and network, the same way a scheduled job does in its default mode. It can run the command several times, some of them side by side, retry failures, and report one final status.
jobs run is the way to run a one-off command today, for example a migration or a console task. The shorter form below is the usual way. A failed attempt is retried after an exponentially growing delay (first delay APP_JOBS_RETRY_BACKOFF, capped by APP_JOBS_RETRY_BACKOFF_MAX). Every attempt is a normal run: it appears in jobs history <app> with its output and exit code. An attempt that has to wait because the app already has APP_JOBS_MAX_CONCURRENT_PER_APP jobs running is not a failure and spends none of the backoff budget. The job ends Succeeded when all completions succeeded, or Failed once more than backoff-limit attempts have failed. The status carries the counts: completions succeeded, failed attempts, runs in flight and the IDs of the runs.

Run a command with apps run

apps run starts a one-shot job, waits for it, prints the output and exits with the command’s own exit code, so it works in scripts and CI. No terminal is needed. The output is printed when the command finishes, not line by line. A timeout exits 124, and a job that failed without a command exit code (the container could not start) exits 5. Secret values are redacted from the output, and the command line is never echoed. --service S targets one service of a multi-service app. --json prints the finished job, output included, and nothing else. apps run sends a backoff limit of 0, so a failed command runs once; --retries N allows N more attempts. Use apps exec instead to run inside the live container. The dashboard has the same thing on an app’s Exec tab, in the Run in a fresh container card. It splits the line into arguments without a shell, always sends a backoff limit of 0, polls the job once a second and shows the output and exit code when it ends. The Exec tab’s first card, by contrast, runs inside the live container.

API

POST /api/v1/jobs/runs starts a job and answers 202 with its status. GET /api/v1/jobs/runs/{id} returns the status. One-off runs and scheduled jobs follow console exec access rules: starting a one-off run, and creating, updating or running a scheduled job now, needs the root ability on the app and exec enabled for that app (PUT /api/v1/apps/{name}/exec-access). Reading needs read. The GET answer also carries the newest attempt’s exit_code, run_status and output (at most APP_JOBS_MAX_OUTPUT_BYTES bytes, default 65536, the same limit a run keeps; output_truncated is set when the output was cut), so one call is enough to see what the command printed. The output field (and a job’s last_run_output) is only returned to callers with the read_sensitive ability, since a command can print values that redaction does not know about; a read-only caller gets the status and exit code plus output_withheld: true.

Settings

Limits today

  • Job status is stored, so GET keeps answering after a restart. A job that was still running when the control plane restarted is marked Failed with a message saying so, and its progress counts are kept. It is not resumed, because that could run the command twice: start a new job to redo the remaining work.
  • The command runs against an app. Running a bare image with no app is not supported yet.
  • Each job leaves a hidden, disabled task row so its runs have a history to live in. It is named oneshot-<job id>, shows in jobs list and is removed when the job is pruned.
Last modified on November 8, 2026