lium exec
Execute a command on one or more pods.
lium exec TARGETS [COMMAND] [OPTIONS]
Arguments​
TARGETS— Pod name, index, comma-separated list, orall.COMMAND— The command to execute. Optional when you pass--script.
Options​
| Flag | Effect |
|---|---|
--script, -s PATH | Execute a local script file on the pod(s) instead of an inline command |
--env, -e KEY=VALUE | Set an environment variable for the command (repeatable) |
--json | Print machine-readable JSON instead of raw output |
lium exec exits with the remote command's own exit code, so
lium exec my-pod "cmd" && next-step behaves the way you expect.
The --json payload is always an envelope with an array, even for a single pod:
{
"ok": true,
"results": [
{"pod": "eager-wolf-aa", "stdout": "…", "stderr": "", "exit_code": 0, "error": null}
]
}
ok is true only when every pod succeeded. Read a single result with
jq -r '.results[0].stdout' — there is no top-level stdout.
Examples​
lium exec my-pod "python train.py"
lium exec 1 "nvidia-smi"
lium exec 1,2,3 "apt update" # Multiple pods
lium exec all "pip install numpy" # Every running pod
lium exec my-pod --script ./setup.sh # Run a local script
lium exec my-pod -e WANDB_MODE=offline "python train.py"
lium exec my-pod --json "python train.py" # Parse the result programmatically