> ## 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.

# Backup Overview

> How PopLock's three-tier backup system protects your server data.

PopLock maintains three distinct archive types, each created by a different mechanism and suited to a different recovery scenario. All archives are stored in a single directory:

```text theme={null}
/usr/local/games/minecraft_server/java/backups/
```

## Archive types

| Type           | Filename Pattern                          | Created By           | Contains                                        |
| -------------- | ----------------------------------------- | -------------------- | ----------------------------------------------- |
| Daily Snapshot | `snapshot_YYYYMMDD_HHMMSS.tar.gz`         | Cron / `snapshot.sh` | Worlds + `whitelist.json` + `server.properties` |
| Full Backup    | `minecraft_backup_YYYYMMDD_HHMMSS.tar.gz` | `serv backup`        | Entire server directory                         |
| Restore Undo   | `restore_undo.tar.gz`                     | `serv restore`       | Whatever was replaced in the last restore       |

***

## Daily snapshots

Daily snapshots are created automatically by `snapshot.sh`, typically triggered by a cron job at 11:30 PM so the server is down at midnight.

A snapshot captures only what changes between sessions:

* All world directories (`world`, `world_nether`, `world_the_end`, and any others present)
* `whitelist.json`
* `server.properties`

This makes snapshots significantly smaller and faster to create than a full backup, and they are the primary recovery tool for world corruption or accidental terrain changes.

Snapshots older than **7 days** are deleted automatically at the end of each snapshot run.

If the server is online when the cron fires, `snapshot.sh` runs a **30-minute in-game countdown** (with announcements at 30m, 15m, 10m, 5m, 1m, 30s, 15s, and 5s) before stopping the server. If the server is already offline, the countdown is skipped and the snapshot is taken immediately.

***

## Full backups

A full backup captures the **entire server directory** — JARs, configs, plugins, world data, and everything else — excluding the `backups/` folder itself and a small set of build artifacts (`cache/`, `work/`, `BuildTools*`, etc.).

Full backups are meant for pre-update safety nets or before major configuration changes where you want a complete rollback option.

**Trigger a manual full backup:**

```bash theme={null}
# Interactive — prints progress to stdout
serv backup

# Silent — no output, suitable for scripting or additional cron jobs
serv backup -s
```

The command stops the server if it is running, creates the archive, and restarts the server afterward. If the server was already offline it is left offline after the backup completes.

***

## Restore undo

The restore undo archive is a safety net created automatically every time you run `serv restore` (with one exception — see below). Before any files are overwritten, the restore command archives exactly what it is about to replace and saves it as `restore_undo.tar.gz`.

* For a **daily snapshot restore**: only the affected world directories and config files are captured in the undo archive.
* For a **full backup restore**: the undo archive contains the entire server directory (same scope as a full backup).

This means a bad restore can always be reversed by running `serv restore` again and selecting **Restore Undo**.

<Info>
  The restore undo file is a single fixed-name archive. Each restore overwrites the previous undo point — only one undo point is kept at a time. If you need to preserve an undo point, copy `restore_undo.tar.gz` to a safe location before performing another restore.
</Info>

***

## Viewing available backups

All three archive types are listed together in the interactive restore menu:

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

You can also query the list programmatically via the API:

```bash theme={null}
curl http://your-server:6767/api/backups
```
