shotbot
Scheduled screenshots of web dashboards with headless Chromium.
shotbot opens a set of pages in headless Chromium on a schedule, takes screenshots of selected elements and posts them somewhere only when they actually changed. I use it for a couple of game stats dashboards and for watching a few status pages.
How it works
- One long-lived browser, one context per job, pages are reused between runs.
- Each job waits for a CSS selector, optionally hides elements (cookie banners, clocks) and crops to the target element.
- A perceptual hash is compared with the previous run; below the threshold nothing is posted.
Job file
[[job]]
name = "weekly-stats"
url = "https://example.org/dashboard"
selector = "#stats"
hide = [".cookie-banner", "#clock"]
every = "30m"
post_to = "discord:stats"
threshold = 6
Running on a small VPS
Chromium is the heavy part. On a 2 GB machine the following keeps it stable:
--disable-dev-shm-usage --no-zygote --renderer-process-limit=2
and a systemd unit with MemoryMax=900M plus Restart=on-failure, so a runaway renderer takes down only the bot and not the box.
Changes
- 0.4.1 — Pages are reused between runs; memory use on a 2 GB VPS roughly halved.
- 0.4.0 — Perceptual diff: unchanged screenshots are no longer posted.