This guide shows how to run the live view app from the Pi’s .venv as a self-restarting service.
Store runtime arguments here so you can tweak them without editing the service unit.
sudo tee /etc/default/pocketscope-live-view >/dev/null <<'EOF'
POCKETSCOPE_URL="https://adsb.chrispatten.dev/data/aircraft.json"
POCKETSCOPE_CENTER="42.00748,-71.20899"
POCKETSCOPE_HOME="$HOME/.pocketscope"
POCKETSCOPE_RUNWAYS_FILE="$HOME/pocket-scope/src/pocketscope/assets/runways.json"
POCKETSCOPE_RUNWAYS_SQLITE="$POCKETSCOPE_HOME/runways.sqlite"
EOFsudo tee /etc/systemd/system/pocketscope.service >/dev/null <<'EOF'
[Unit]
Description=PocketScope live view (TFT)
Wants=network-online.target
After=network-online.target
StartLimitBurst=10
StartLimitIntervalSec=60
[Service]
Type=simple
# Prefer the templated unit `pocketscope@.service` which accepts a username
# instance and avoids hardcoded paths. Example usage is shown below.
EnvironmentFile=-/etc/default/pocketscope-live-view
Environment=PYTHONUNBUFFERED=1
# Uncomment if you need to target the framebuffer directly:
# Environment=SDL_VIDEODRIVER=fbcon
# Environment=SDL_FBDEV=/dev/fb0
ExecStart=%h/pocket-scope/.venv/bin/python -m pocketscope \
--url ${POCKETSCOPE_URL} \
--center ${POCKETSCOPE_CENTER} \
--tft \
--runways-geojson ${POCKETSCOPE_RUNWAYS_FILE} \
--runways-sqlite ${POCKETSCOPE_RUNWAYS_SQLITE} \
--runway-icons
KillSignal=SIGINT
TimeoutStopSec=15
Restart=always
RestartSec=3
# Uncomment if you need additional device access:
# SupplementaryGroups=gpio,spi,video
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOFsudo systemctl daemon-reload
# To enable for a specific user (for example `pocketscope`) using the
# templated unit, copy the unit and enable the instance:
# sudo cp bootstrap_assets/pocketscope@.service /etc/systemd/system/
# sudo systemctl daemon-reload
# sudo systemctl enable --now pocketscope@pocketscope.service
sudo systemctl daemon-reloadsystemctl status pocketscope.service --no-pager
journalctl -u pocketscope.service -fTo change runtime flags, edit the environment file:
sudo nano /etc/default/pocketscope-live-viewThen restart the service:
sudo systemctl restart pocketscope.serviceGood for debugging before relying on systemd:
.venv/bin/activate
cd "$HOME/pocket-scope"
. .venv/bin/activate
python -m pocketscope \
--url "https://adsb.chrispatten.dev/data/aircraft.json" \
--center "42.00748,-71.20899" The live viewer installs a SIGUSR1 handler that requests a screenshot on the next frame. PNGs are saved under:
~/.pocketscope/screenshots/
Trigger a capture:
sudo systemctl kill -s SIGUSR1 pocketscope.serviceCheck logs for the saved path:
journalctl -u pocketscope.service -n 50 | grep screenshotYou can also drop a file named screenshot inside ~/.pocketscope/commands/ to trigger a capture (the file is consumed and removed automatically).