6e68300d05
Ship systemd/screencast-receiver.service, a template the install script substitutes (binary path, run user) and enables so the receiver starts at boot after the network and avahi-daemon, with restart-on-failure and a raised start limit for slow-booting boards. SIGTERM gives the graceful shutdown that withdraws the mDNS announcement — systemctl stop never triggers the stale-record trap that kill -9 does. Headless consoles render via KMSDRM (the script adds the run user to video/render/input); desktop autologin sessions uncomment two documented Environment lines. The install script gains SC_RECEIVER_SERVICE=0 to opt out. Validated: systemd-analyze verify on the substituted unit (only the expected missing /usr/local/bin path on this dev machine), and a live lifecycle test as a user unit: the service-managed receiver announced itself (--discover found it), systemctl stop produced a clean exit (Result=success, no restart) and the mDNS announcement was withdrawn immediately.
46 lines
1.6 KiB
Desktop File
46 lines
1.6 KiB
Desktop File
# screencast-receiver.service — autostart for the receiver.
|
|
#
|
|
# This file is a template: scripts/install-receiver.sh substitutes
|
|
# __SC_RECEIVER_BIN__ and __SC_RECEIVER_USER__ before installing it to
|
|
# /etc/systemd/system/screencast-receiver.service.
|
|
#
|
|
# Display environments:
|
|
#
|
|
# 1. Headless console (SDL renders via KMSDRM): works as installed. The
|
|
# configured User needs access to /dev/dri and the input devices; the
|
|
# install script adds it to the video/render/input groups.
|
|
#
|
|
# 2. Graphical session (Wayland or X11 desktop with autologin): uncomment
|
|
# the Environment lines in [Service] and adjust them to the session
|
|
# owner (XDG_RUNTIME_DIR usually lives in /run/user/1000).
|
|
|
|
[Unit]
|
|
Description=Screencast receiver (H.264 over RTP/UDP)
|
|
Wants=network-online.target
|
|
After=network-online.target avahi-daemon.service
|
|
# Give slow-booting boards (and desktop sessions that start late) a chance;
|
|
# systemd's default limit would give up after 5 fast failures.
|
|
StartLimitIntervalSec=30
|
|
StartLimitBurst=10
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=__SC_RECEIVER_USER__
|
|
ExecStart=__SC_RECEIVER_BIN__ --receive
|
|
# SIGTERM (systemctl stop) shuts the receiver down gracefully, which
|
|
# withdraws its mDNS announcement. Never SIGKILL it; the systemd default
|
|
# KillMode escalates only after the graceful timeout.
|
|
KillSignal=SIGTERM
|
|
TimeoutStopSec=10
|
|
Restart=on-failure
|
|
RestartSec=3
|
|
NoNewPrivileges=true
|
|
PrivateTmp=true
|
|
|
|
# Graphical session: uncomment and adjust to the session owner.
|
|
#Environment=XDG_RUNTIME_DIR=/run/user/1000
|
|
#Environment=WAYLAND_DISPLAY=wayland-0
|
|
#Environment=DISPLAY=:0
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target |