Skip to content

qc exec

Run commands server-side on an environment. Unlike qc ssh --command, which dies with your terminal session, an exec run executes in a one-off container on the platform — it keeps going if your laptop sleeps, your network drops, or you close the terminal. The CLI only watches progress, and you can reattach at any time. For a task-oriented walkthrough, see the remote commands guide.

Command Description
qc exec run Run a command and watch it until it completes.
qc exec status Show status and output for a run, or reattach with --watch.
qc exec list List command runs for the environment.

All exec subcommands accept --org, --app, --env, and --platform overrides.


Create a server-side run and poll it until it reaches a terminal state. The remote command’s exit code becomes the CLI’s exit code, so qc exec run is safe to use in scripts and CI.

Terminal window
qc exec run "<command>" [options]
Flag Description Default
--container <name> Target a specific container. First container in the task definition
--detach Start the run and return immediately (prints the run ID).
--interval <sec> Poll interval in seconds (minimum 5). 15
--org <org> Override organization.
--app <app> Override application.
--env <env> Override environment.
--platform <platform> Override platform.
Terminal window
# Run a long task and watch it — safe to sleep the laptop mid-run
qc exec run "drush cron"
# Target a specific container
qc exec run "php artisan queue:work --once" --container php
# Fire and forget
qc exec run "./import.sh" --detach

Commands containing shell operators (&&, ;, |, …) are automatically run through /bin/sh -c on the server — write them flat rather than nesting your own sh -c '...' quoting:

Terminal window
# Good
qc exec run "echo start && ./migrate.sh"
# Avoid — nested quoting gets mangled
qc exec run "sh -c 'echo start && ./migrate.sh'"

Pressing Ctrl+C while watching only detaches the CLI — the run continues on the server and the CLI prints the qc exec status command to reattach.


Show the current status, metadata, and output for a run. With --watch, reattach and poll until the run completes — the accumulated output is reprinted from the beginning, then new lines stream as they arrive.

Terminal window
qc exec status <runId> [options]
Flag Description Default
--watch Poll until the run completes (reattach).
--interval <sec> Poll interval in seconds (minimum 5). 15
--org <org> Override organization.
--app <app> Override application.
--env <env> Override environment.
--platform <platform> Override platform.
Terminal window
# One-shot status check
qc exec status 411fc62f-b8d5-4d7c-b8af-5a53f371d222
# Reattach after a detach, laptop sleep, or from another machine
qc exec status 411fc62f-b8d5-4d7c-b8af-5a53f371d222 --watch

List command runs for the environment.

Terminal window
qc exec list [options]