> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ns.rocks/llms.txt
> Use this file to discover all available pages before exploring further.

# Start And Ready Commands

> Configure template startup commands and readiness probes.

`set_start_cmd()` configures a command that starts during template build before
snapshotting. Readiness probes tell Nullspace when that command is ready, then
machines created from the template restore the snapshotted running state
instead of rerunning the command.

Create-time `Machine.create(envs=...)` values are not visible to the template
start command. Use `set_runtime_envs()` for runtime defaults that should be
present in launched machines.

For warm pools, treat the template start command and readiness probe as the
complete service boot contract. A pooled machine may restore an already-ready
VM, so service startup must not depend on create-time envs, volume mounts, cwd
overrides, desktop settings, or per-create networking options.

## Start command

```python theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
from nullspace import Template, wait_for_port

builder = (
    Template.from_python_image("3.12")
    .copy("./server.py", "/workspace/server.py")
    .set_workdir("/workspace")
    .set_start_cmd("python server.py", readiness=wait_for_port(8080))
)
```

## Readiness helpers

```python theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
from nullspace import wait_for_file, wait_for_process, wait_for_timeout, wait_for_url

wait_for_file("/tmp/ready")
wait_for_process("python")
wait_for_timeout(5_000)
wait_for_url("http://127.0.0.1:8080/health")
```

`wait_for_url()` is an in-guest local HTTP readiness probe. It accepts only
`http://` URLs on `localhost`, `127.0.0.1`, or `0.0.0.0`, requires an explicit
port, and rejects query strings, fragments, and embedded credentials.

Concept: [Create](../../concepts/create). API reference:
[buildTemplate](../../api-reference), [getTemplateBuildStatus](../../api-reference).
