[Unit] Description=WalnutPi H618 Matrix Screen Controller After=NetworkManager.service Wants=NetworkManager.service [Service] Type=simple WorkingDirectory=/opt/matrix-screen-controller Environment=MATRIX_DRIVER=auto Environment=MATRIX_DATA_DIR=/var/lib/matrix-screen-controller Environment=MATRIX_RUNTIME_DIR=/run/matrix-screen-controller Environment=PYTHONDONTWRITEBYTECODE=1 Environment=MATRIX_MEDIA_WORKER_MODE=systemd StateDirectory=matrix-screen-controller StateDirectoryMode=0711 RuntimeDirectory=matrix-screen-controller RuntimeDirectoryMode=0750 RuntimeDirectoryPreserve=yes CPUAffinity=0 1 2 LimitRTPRIO=50 LimitMEMLOCK=infinity LimitRTTIME=infinity ExecStartPre=/bin/sh -c 'cat /proc/sys/kernel/sched_rt_runtime_us > /run/matrix-screen-controller/sched_rt_runtime_us.original && printf "%%s\n" -1 > /proc/sys/kernel/sched_rt_runtime_us' ExecStartPre=/opt/matrix-screen-controller/.venv/bin/python /opt/matrix-screen-controller/scripts/dedicated_host.py check --service ExecStartPre=/opt/matrix-screen-controller/app/display/native/hub75_safeoff ExecStart=/opt/matrix-screen-controller/.venv/bin/python -m uvicorn app.main:app --host 0.0.0.0 --port 8080 ExecStopPost=/opt/matrix-screen-controller/app/display/native/hub75_safeoff ExecStopPost=/opt/matrix-screen-controller/.venv/bin/python -m app.system.performance restore --runtime-root /run/matrix-screen-controller ExecStopPost=/bin/sh -c 'if test -f /run/matrix-screen-controller/sched_rt_runtime_us.original; then cat /run/matrix-screen-controller/sched_rt_runtime_us.original > /proc/sys/kernel/sched_rt_runtime_us; rm -f /run/matrix-screen-controller/sched_rt_runtime_us.original; fi' Restart=on-failure RestartSec=3 [Install] WantedBy=multi-user.target