---
description: Running one Screenshotter per sign unattended — the preconditions, API key handling, the systemd and Task Scheduler templates with their setup steps, the operations checklist, failure signals, what the server rejects and why, LED walls, and the tuning knobs for unstable networks.
---

# Run Screenshotter as a service

A sign computer reboots, loses power, gets logged in by someone else. For an event the
Screenshotter has to come back by itself, so run it as a service: a systemd unit on
Linux, a Task Scheduler task on Windows, each starting the same command that
[Install and run Screenshotter](user_guide.md) describes, as soon as the sign account's
desktop session exists. This page is for the person who operates the fleet.

## Preconditions

- The screenshot upload endpoint is reachable from every sign computer.
- The Screenshotter API key is configured on the server and rotated before the event.
- Every sign has a unique sign name — two agents with the same name fight over one slot.
- The host clock is right (NTP).
- The agent runs in the desktop session that drives the screen; a service without access
  to that session captures nothing (see
  [Screenshotter permissions and troubleshooting](permissions_troubleshooting.md)).
- The sign account signs in automatically at boot. Neither template can create a desktop
  session: the Windows task starts at that account's logon, and the Linux units need the
  account's graphical session. Without automatic login, a rebooted computer waits at the
  login screen with nothing to capture until someone signs in.
- For a plain-jar install, Java 21 or newer on the computer. The downloadable
  applications carry their own runtime and need no Java.

Use the [baseline settings](values_and_flags.md#baseline-settings) unless you have a
reason not to, and keep the API key in an environment variable or a protected settings
file — never in a command line that ends up in a shell history or a task definition.

## Auto-restart templates

Downloadable templates, one launcher script plus one settings file per sign:

| Linux systemd | Windows Task Scheduler |
| --- | --- |
| [sign-capture@.service](deploy/systemd/sign-capture@.service) (system unit) | [Register-SignCaptureTask.ps1](deploy/windows/Register-SignCaptureTask.ps1) |
| [sign-capture-user@.service](deploy/systemd/sign-capture-user@.service) (user unit, runs inside the desktop session) | [run-sign-capture.ps1](deploy/windows/run-sign-capture.ps1) |
| [run-sign-capture.sh](deploy/systemd/run-sign-capture.sh) | [sign-capture.config.ps1.example](deploy/windows/sign-capture.config.ps1.example) |
| [sign-capture.env.example](deploy/systemd/sign-capture.env.example), [sign-capture.lobby-a.env](deploy/systemd/sign-capture.lobby-a.env), [sign-capture.raspberry-pi.env](deploy/systemd/sign-capture.raspberry-pi.env) | [sign-capture.lobby-a.config.ps1](deploy/windows/sign-capture.lobby-a.config.ps1) |

### Linux systemd

1. Copy `run-sign-capture.sh` to `/opt/preseria/screenshotter/deploy/systemd/` and make
   it executable; copy `sign-capture@.service` to `/etc/systemd/system/`.
2. Create one settings file per sign from `sign-capture.env.example`, for example
   `/etc/preseria/sign-capture/lobby-a.env`, and fill in the upload URL, event ID, sign
   name and API key. Point it at your install: `LAUNCHER_BIN` for the self-contained build
   (the tarball's `bin/PreseriaScreenshotter`, or a `.deb`/`.rpm` install), or `JAVA_BIN`
   plus `JAR_PATH` for a plain jar run by an installed Java 21 or newer. Set one or the
   other — the launcher refuses to guess when both are present. Protect the file
   (`chmod 600`).
3. `sudo systemctl daemon-reload && sudo systemctl enable --now sign-capture@lobby-a.service`
4. Check with `systemctl status sign-capture@lobby-a.service` and
   `journalctl -u sign-capture@lobby-a.service -f`.

The unit runs as `User=signage` / `Group=signage`; adjust it to your sign account. If
capture needs display authentication on X11, set `DISPLAY` and `XAUTHORITY` in the env
file. The unit deliberately leaves `ProtectHome=false` — enabling it hides both
`XAUTHORITY` and the Wayland socket from the service.

**Wayland hosts** (Raspberry Pi OS, and increasingly desktop Linux): the built-in capture
returns a black frame there, and the agent switches to `grim` by itself (`sudo apt install
grim`); `CAPTURE_MODE=grim` in the env file pins it. The service must also reach the
session — `WAYLAND_DISPLAY=wayland-0` and `XDG_RUNTIME_DIR=/run/user/<uid>` for the
`User=` account, which must be logged in to the desktop. On a single-user sign host the
**user unit** `sign-capture-user@.service` is simpler: it runs inside the session, where
both variables are already right. The walkthrough is on
[Screenshotter on Raspberry Pi](raspberry_pi.md#start-automatically-at-boot).

### Windows Task Scheduler

1. Copy `run-sign-capture.ps1` and `Register-SignCaptureTask.ps1` to the sign computer,
   for example into `C:\Preseria\sign-capture\`.
2. Create one settings file per sign from `sign-capture.config.ps1.example`, for example
   `C:\ProgramData\Preseria\sign-capture\lobby-a.config.ps1`, and fill in the values.
   Point it at your install: `$LauncherExe` for the portable ZIP
   (`C:\Preseria\PreseriaScreenshotter\PreseriaScreenshotter.exe`, kept together with its
   `app` and `runtime` folders), or `$JavaExe` plus `$JarPath` for a plain jar run by an
   installed Java 21 or newer. Set one or the other — the launcher refuses to guess when
   both are present.
3. Signed in **as the sign account**, store the API key once in that account's
   environment, where the launcher reads it (`Process`, then `User`, then `Machine`):
   `[Environment]::SetEnvironmentVariable("SCREENSHOTTER_API_KEY", "<api_key_here>", "User")`
4. Register the task with a **logon trigger**, which is what desktop capture needs. From
   an elevated PowerShell in the folder of step 1:
   `powershell -ExecutionPolicy Bypass -File .\Register-SignCaptureTask.ps1 -TaskName "Preseria-SignCapture-LobbyA" -ConfigPath "C:\ProgramData\Preseria\sign-capture\lobby-a.config.ps1" -UserId "<COMPUTER-OR-DOMAIN\signage>"`
   `-UserId` is the sign account; the task runs interactively in that account's desktop
   session, inherits its environment (so the key from step 3 is visible) and retries a
   failed task after one minute, up to 999 times — a task that exits with status 0 is not
   restarted. Use `-AtStartup` only if you deliberately want the task to run as `SYSTEM`
   before anyone logs in — it will not see the desktop.
5. Check with `Get-ScheduledTask -TaskName "Preseria-SignCapture-LobbyA"`, start it once
   with `Start-ScheduledTask -TaskName "Preseria-SignCapture-LobbyA"`, and confirm the sign
   appears on the [live sign dashboard](../signs/live_dashboard.md) showing this
   computer's screen. Then sign out and back in (or reboot, with automatic login
   configured) and confirm it comes back without any typing.

## Rolling out

1. Start on two signs and confirm each shows up on the
   [live sign dashboard](../signs/live_dashboard.md) with a thumbnail and a full-size
   image.
2. Expand to the rest; confirm every sign is visible and that the logs show no repeating
   `Upload failed` lines.
3. Reboot one computer and confirm the agent comes back once the sign account's desktop
   session is restored — automatically, if the account logs in at boot — without anyone
   typing a command.
4. Before a large event, run a two-to-four-hour soak with normal and peak content.

During the event, watch the dashboard for signs that go stale and the logs for repeated
`Upload failed after …` messages; when failures cluster, check the server's health and the
network path from the sign VLAN first.

### Thumbnail detail rollout

Keep 200 px as the fleet default. If selected signs need clearer grid previews, raise
their requested maximum to 400 px after checking encoding time, venue traffic and
dashboard responsiveness. Detailed inspection already uses the original screenshot.

1. Plan an event-free maintenance window and pause existing Screenshotter agents.
   Have your administrator deploy the matching backend and check that its thumbnail
   height limit on every node covers the largest planned agent value. Both supported
   production packages already allow 400 px. A custom limit must stay between 200
   and 400 px and cover every agent's setting.
2. Deploy an agent build that supports `--thumbnail-height` together with its launcher
   script. Check the startup banner for `Thumbnail height: 200px` (or `400px` when
   selected). Old binaries exit with `Unknown flag: --thumbnail-height`, even at 200.
   Before restarting agents, set their heartbeat to 60 seconds and keep capture intervals
   at 30 seconds or less, preferably 10, for the reporting-alert thresholds.
3. Set `THUMBNAIL_HEIGHT=400` in a Linux settings file, or `$ThumbnailHeight = 400` in a
   Windows settings file, and restart two test signs. The local sign farm uses
   `SCREENSHOTTER_THUMBNAIL_HEIGHT`; the Ansible inventory uses
   `screenshotter_thumbnail_height`. All default to 200.
4. Confirm both thumbnails and full-size snapshots appear without repeating `422`
   responses, then expand to the selected signs.

Keep dashboard sound and desktop alerts off while agents are deliberately paused.
Enable them after all intended agents have resumed and confirmed contact. This paused,
event-free rollout can update the backend before restarting the updated agents; the
heartbeat-first procedure below applies when agents remain running during the upgrade.

The actual stored thumbnail can be smaller to fit its byte budget or the uploaded
original. Its fixed quality of 85 can make even a smaller thumbnail outweigh a
larger original encoded at lower quality. If the requested height reaches the
original's height, it becomes a full-resolution quality-85 copy. The 256 KiB
thumbnail ceiling stays fixed, but higher settings increase typical upload, database
and dashboard-download work. See [Venue bandwidth planning](venue_bandwidth_planning.md).

A server limit below the agent's setting produces `422`; there is no automatic
fallback. Deploy between events and update the backend, agents and launcher scripts
together. For rollback, first reset agents to 200, then restore the matching backend
and agent packages during the maintenance window.

## Failure signals

| Signal | Usual cause |
| --- | --- |
| A sign has no fresh screenshot for more than two heartbeat windows | The agent or the computer stopped, or the heartbeat is off and the content is static |
| Repeated `5xx` responses or timeouts despite retries | Server or network trouble — check both before touching the agent |
| Repeating `429` responses | Two agents share a sign name, or something uploads faster than once per 5 s for the sign |
| A repeating non-retryable `4xx` every capture interval | A configuration or contract problem; the status code says which (below) |
| The process exits on every restart | The command is wrong — the first lines of the log say what; see [troubleshooting](permissions_troubleshooting.md) |

## What the server rejects

The agent stays inside the server's limits by construction — it downscales to its pixel
budget, re-encodes within its byte budget and bounds the thumbnail — so a rejection means
a misconfiguration or a mismatched version rather than a large screen. The agent retries
only `408`, `429` and `5xx`; every other rejection fails that upload, and the next interval
tries again, so a persistent problem shows as the same line repeating in the log, with the
server's reason quoted in the `Upload failed` message.

| Response | Meaning |
| --- | --- |
| `400` | Bad identity — a sign name over 191 characters, or a malformed request |
| `401` | The API key does not match the server's |
| `404` | The event ID does not exist |
| `413` | A part is larger than the server allows (2 MiB original, 256 KiB thumbnail by default) — only possible with raised budgets or an old agent |
| `415` | Not WebP, or an agent using the retired raw-body upload: upgrade it |
| `422` | Image geometry outside the server's limits (4096 px per side, 4.5 MP by default) or a thumbnail above the configured height limit or with a different aspect ratio |
| `429` | Uploads faster than one per 5 s for this sign — retried |
| `409` | A body-less heartbeat whose hash no longer matches the stored image — the agent falls back to a full upload by itself |
| `503` | The server is saturated — retried |

The [live dashboard](../signs/live_dashboard.md) warns at **90 seconds** without a
successful screenshot or heartbeat and shows **Not reporting** at **180 seconds**.
Both thresholds are server-configurable. A failed API-key check does not refresh contact.
A short interruption is still worth investigating, even if the next request restores
normal reporting. Retained cards stay visible for 24 hours by default.

### Upgrade heartbeats before the backend

If agents remain running during the upgrade, update them and their launch configuration
**before deploying the backend with the 90-second warning deadline**. A 60-second
heartbeat also works with the previous backend. For the paused thumbnail rollout above,
configure the same heartbeat and capture interval before restarting agents and enabling alerts.

1. Replace older launcher scripts with the current versions, or explicitly configure
   60 seconds: `$HeartbeatSeconds = 60` on Windows, `HEARTBEAT_SECONDS=60` for systemd,
   `SCREENSHOTTER_HEARTBEAT_SECONDS=60` in the local sign farm, or `--heartbeat=60` when
   invoking the agent directly. Update any existing 90-second overrides too. The old
   Windows, systemd and sign-farm launchers supplied **90 seconds** even when nobody
   configured a value; upgrading the agent alone does not replace that launcher setting.
   Only older agents run directly without the flag defaulted to no heartbeat.
2. Keep the capture interval at **30 seconds or less**, preferably the default **10
   seconds**. Heartbeats are checked inside the capture loop, so capture ticks, processing
   and request time extend the gap; a failed heartbeat waits for the next tick. An interval
   of 45–59 seconds can cross the warning deadline even when the device is healthy.
3. Restart the agents with those settings and check successful contact on a fully static
   screen. Confirm the effective launch arguments/settings, including service or sign-farm
   overrides, before deploying the backend.

Leaving an old 90-second heartbeat in place can repeatedly flip a static sign from
**Delayed** to **Reporting** with the 90-second warning deadline. Each recovery rearms
alerts, producing repeated tones/notifications across the fleet and quickly filling the
20-entry history.
Content that changes frequently can mask this configuration problem.

Enable **Sound alerts** in the dashboard and listen for the test tone before a show.
Optionally enable **Desktop notifications** separately, allow the browser's site
permission and verify the test notification. Both options start off on each visit;
either requests contact checks every ten seconds while the dashboard is visible.
Background or minimized tabs can slow to about once a minute; on Windows, a window fully
covered by another application can also be throttled. Keep the dashboard in its own
visible window and the operator's computer awake. A blocked notification permission does
not disable sound. Check browser/system notification settings and Do Not Disturb.
Browser muting, suspension and system volume can prevent delivery. Leaving the dashboard stops its alerts and
closes its notifications; this feature does not send alarms after the page closes.

## LED walls and large canvases

The default pixel budget (the Full HD area) keeps text readable on ordinary signs. For an
LED wall fed a 5K or 8K framebuffer with dense content — an event scoped schedule, say —
raise the budgets for that sign only:

```text
--max-pixels=4500000 --max-upload-bytes=2097152
```

These are the server's default ceilings, so nothing else needs changing. An 8K schedule
wall then uploads at roughly 2716 × 1528, which keeps 40-pixel text readable in the
dashboard's inspect view, and adds at most about 1.9 Mbps to the venue's worst-case uplink
(see [Venue bandwidth planning](venue_bandwidth_planning.md)). Many "8K" walls are
physically large but driven by a Full HD or 4K framebuffer; the agent captures the
framebuffer, so those need no special configuration.

## Tuning for unstable networks

| Situation | Change |
| --- | --- |
| The network or the server drops requests | `--upload-retries=6`, `--retry-base-delay-ms=1500`, and `--read-timeout-ms=15000` |
| Updates feel slow | `interval` down to `7`; validate the server load before going lower, and never below `5` |
| Bandwidth is constrained | `interval` up to `20` or `30` first; keep `--heartbeat=60` so static signs remain monitored |

## Related

- [Install and run Screenshotter](user_guide.md)
- [Screenshotter values and flags](values_and_flags.md)
- [Screenshotter on Raspberry Pi](raspberry_pi.md)
- [Screenshotter permissions and troubleshooting](permissions_troubleshooting.md)
- [Venue bandwidth planning](venue_bandwidth_planning.md)
- [Live sign dashboard](../signs/live_dashboard.md)
