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

# Update the server

> How to check for and apply PaperMC or Vanilla Minecraft server updates using serv update.

<Warning>
  `serv update` stops the server during the update process. Schedule updates during a maintenance window to avoid interrupting active players.
</Warning>

## PaperMC

<Steps>
  <Step title="Check for an available update">
    Run `serv chk` to query the PaperMC API and compare the latest build against your current version:

    ```bash theme={null}
    serv chk
    ```

    If an update is available, the output will show the current and latest build numbers and prompt you to run `serv update`.
  </Step>

  <Step title="Apply the update">
    ```bash theme={null}
    serv update
    ```

    You will be shown a summary of what the command will do and asked to confirm before anything changes.
  </Step>

  <Step title="What happens during the update">
    The update process runs the following steps automatically:

    1. Stops the server (if running)
    2. Backs up the current jar to `backups/jars/paper_VERSION.jar`
    3. Downloads the latest build from the PaperMC API
    4. Restarts the server

    If the download fails at step 3, the backup jar is automatically restored and the server is left unchanged.
  </Step>
</Steps>

## Vanilla

<Steps>
  <Step title="Check for an available update">
    ```bash theme={null}
    serv chk
    ```

    For Vanilla servers, this checks against Mojang's version manifest.
  </Step>

  <Step title="Apply the update">
    ```bash theme={null}
    serv update
    ```
  </Step>

  <Step title="What happens during the update">
    1. Stops the server (if running)
    2. Backs up the current jar to `backups/jars/old.vanillaserver.jar`
    3. Downloads the latest release from Mojang
    4. Restarts the server

    If the download fails, the backup jar is automatically restored.
  </Step>
</Steps>

## API sources

The `serv` script queries the following APIs to determine the latest available version:

| Server type | API endpoint                                                      |
| ----------- | ----------------------------------------------------------------- |
| PaperMC     | `https://fill.papermc.io/v3/projects/paper`                       |
| Vanilla     | `https://piston-meta.mojang.com/mc/game/version_manifest_v2.json` |

## Silent update check

Use the `-s` flag to suppress output when the server is already up to date. This is useful in cron jobs or scripts that should only produce output when action is needed:

```bash theme={null}
serv chk -s
```

<Tip>
  The backup jar is always kept in `backups/jars/` after an update. If you need to roll back manually, replace `server.jar` with the appropriate file from that directory and restart the server.
</Tip>
