# Keeping it running

qKVM is made to run for months with nobody at it. This page is for whoever runs the server: where it writes, what to monitor, and how it comes back after a restart.

## What it does by itself

- **A KVM that is down does not slow the others.** It is tried less and less often, up to every 15 seconds, and picked up again when it comes back.
- **It carries on after a restart.** qKVM opens the saved device passwords at start, and goes on watching and alerting without anybody signing in.
- **Settings are written safely**, with a second copy, `qkvm.bak`. Where `qkvm.json` is damaged, qKVM starts from the copy and says so. A change that cannot be saved (a full disk) is refused.
- **One copy per data folder.** A second `qkvm` on the same folder refuses to start, so typing `qkvm` twice does no harm.

## What to watch

| What | Where |
|---|---|
| Program log | `qkvm.log` in the data folder: starts, devices going down and back, errors. Rotated at 2 MB, three old files kept; `--log-level debug` writes more. |
| Sign-ins and actions | The activity log: see [Activity log](https://qkvm.com/docs/web/activity-log) |
| Health check | `GET /healthz`, without a sign-in |
| Metrics | `GET /metrics`: see [Metrics](https://qkvm.com/docs/web/metrics) |

`/healthz` answers like this:

```
{"status": "ok", "version": "...", "api": ["v1"], "page": "...", "locked": false}
```

- `"locked": true` means qKVM cannot open the saved device passwords yet. Nothing is watched and no alert is sent until somebody signs in, so have your monitor tell you.
- `"video": "unavailable"` means no picture can be made on this computer. The tiles concerned and `qkvm.log` say why.

## After a restart

As it comes, a key in the data folder, `unlock.key`, opens the saved device passwords at start. Two start options change that:

| Option | What it does | Default |
|---|---|---|
| `--unlock-file FILE` | Keeps that key outside the data folder, as a service credential say | `unlock.key` in the data folder |
| `--locked-start` | Keeps no such key: nothing is reached after a restart until somebody signs in | Off |

The separate server storage key is needed to read the settings in every case. A browser signed in with *Keep this browser signed in for 30 days* stays signed in across a restart; others sign in again.

## Backups

*Settings > Backups* makes an encrypted backup of the whole wall every day: see [Backups](https://qkvm.com/docs/web/backups). To copy by hand, stop qKVM, then back up the data folder and the server storage key **separately**. Check a restored pair with `qkvm --verify-vault --vault-key-file <key>` before you start it.

## Good to know

- **Cost per tile:** each tile being looked at costs its KVM one picture a second, and qKVM little. A JetKVM costs more: see [JetKVM](https://qkvm.com/docs/web/jetkvm).
- **Memory on Linux:** qKVM sets `MALLOC_ARENA_MAX=2` and `MALLOC_TRIM_THRESHOLD_=131072`, so memory piles up more slowly over days. Values you set yourself are kept.
- **After changing the program's files by hand, restart it.** Updates installed from inside the app restart it for you.
- **To start it with the computer,** see [Start with the system](https://qkvm.com/docs/web/start-with-the-system).

## Related

- [Start with the system](https://qkvm.com/docs/web/start-with-the-system)
- [Backups](https://qkvm.com/docs/web/backups)
- [Metrics](https://qkvm.com/docs/web/metrics)
- [Updates](https://qkvm.com/docs/web/updates)

[Full reference](https://github.com/qkvm/qkvm/blob/main/GUIDE.md#keeping-it-running)
