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

# LiteFS Run Command

## Overview

The `run` command will execute the program listed after the double dash. It
provides options for promoting the current node or for performing write
forwarding using the `HALT` lock. See the [migrations guide][] for details
about promotion & write forwarding.

[migrations guide]: /litefs/migrations

## Usage

```sh theme={null}
litefs run [arguments] -- CMD [ARGS...]
```

### Arguments

```
  -if-candidate
      only execute if node is a candidate
  -promote
      promote node to primary
  -with-halt-lock-on string
      full database path to halt
```

## Examples

Promote the local node to become the primary and then run Rails migrations:

```sh theme={null}
litefs run -promote -- bin/rails db:migrate
```

Run Rails migrations on the `/litefs/db` database from any node and have those
write forwarded back to the primary node:

```sh theme={null}
litefs run -with-halt-lock-on /litefs/db -- bin/rails db:migrate
```
