[Unit] Description=Microscope camera kiosk (cage + capture UI) Documentation=file:/opt/microscope-camera/README.md After=systemd-user-sessions.service systemd-logind.service Wants=systemd-logind.service Conflicts=getty@tty1.service After=getty@tty1.service ConditionPathExists=/opt/microscope-camera/app.py [Service] Type=simple User=tyler Group=tyler # A logind session on tty1 gives cage DRM master plus input device access. PAMName=login TTYPath=/dev/tty1 TTYReset=yes TTYVHangup=yes TTYVTDisallocate=yes StandardInput=tty StandardOutput=journal StandardError=journal Environment=XDG_RUNTIME_DIR=/run/user/1000 Environment=HOME=/home/tyler Environment=PYTHONUNBUFFERED=1 ExecStartPre=/bin/sh -c 'install -d -m 700 -o tyler -g tyler /run/user/1000' ExecStart=/usr/bin/cage -s -- /usr/bin/python3 /opt/microscope-camera/app.py Restart=always RestartSec=2 # Keep the recorder alive long enough to flush its last frames on restart. KillSignal=SIGTERM TimeoutStopSec=30 [Install] WantedBy=multi-user.target