> ## Documentation Index
> Fetch the complete documentation index at: https://motiadev-docs-deployment-guide.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Exec

> Execute commands in the shell.

Use this worker to run shell commands as part of engine startup — building assets, running migrations, or starting long-lived processes like a production server.

```
iii-exec
```

## Sample Configuration

```yaml theme={"theme":{"light":"catppuccin-latte","dark":"dark-plus"}}
- name: iii-exec
  config:
    exec:
      - cd frontend && npm install
      - cd frontend && npm run build
      - bun run --enable-source-maps index-production.js
```

With file watching:

```yaml theme={"theme":{"light":"catppuccin-latte","dark":"dark-plus"}}
- name: iii-exec
  config:
    watch:
      - steps/**/*.{ts,js}
      - config/*.json
    exec:
      - cd frontend && npm install
      - cd frontend && npm run build
      - bun run --enable-source-maps index-production.js
```

## Configuration

<ResponseField name="exec" type="string[]" required>
  The commands to execute as a sequential pipeline. Each command runs in its own process. Intermediate commands must exit successfully before the next one starts; the final command is kept running as a long-lived process.

  Because each entry is a separate process, you cannot share shell state between entries. Use `&&` to chain operations that must share a working directory:

  ```yaml theme={"theme":{"light":"catppuccin-latte","dark":"dark-plus"}}
  - cd path/to/project && npm run build
  ```

  If an intermediate command exits with a non-zero code, the pipeline stops and the remaining commands are skipped.
</ResponseField>

<ResponseField name="watch" type="string[]">
  Glob patterns that trigger a full pipeline restart on file change. See the warning below for matching limitations.
</ResponseField>

<Warning title="watch pattern limitations">
  Patterns match by root directory and file extension only — the filename portion is ignored. `src/**/*.test.ts` matches all `.ts` files under `src/`, not only test files. Use `**` to watch subdirectories recursively: `config/*.json` only watches the top level of `config/`, while `config/**/*.json` watches at any depth. Files without an extension (e.g., `Makefile`, shell scripts) are never matched.
</Warning>
