From 686a76b2e7d2371b5953c15afb34306f3bddb2ec Mon Sep 17 00:00:00 2001 From: ChuckBuilds <33324927+ChuckBuilds@users.noreply.github.com> Date: Sat, 19 Apr 2025 12:42:30 -0500 Subject: [PATCH] Update service to run as root for hardware timing access --- install_service.sh | 10 +--------- ledmatrix.service | 6 +++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/install_service.sh b/install_service.sh index faeef717..fc96c987 100644 --- a/install_service.sh +++ b/install_service.sh @@ -3,19 +3,11 @@ # Exit on error set -e -# Get the current user -CURRENT_USER=$(whoami) - -echo "Installing LED Matrix Display Service for user: $CURRENT_USER..." +echo "Installing LED Matrix Display Service..." # Copy the service file to the systemd directory sudo cp ledmatrix.service /etc/systemd/system/ -# Create a systemd override to set the user -sudo mkdir -p /etc/systemd/system/ledmatrix.service.d/ -echo "[Service]" | sudo tee /etc/systemd/system/ledmatrix.service.d/override.conf -echo "User=$CURRENT_USER" | sudo tee -a /etc/systemd/system/ledmatrix.service.d/override.conf - # Reload systemd to recognize the new service sudo systemctl daemon-reload diff --git a/ledmatrix.service b/ledmatrix.service index b76dc894..2f7a9fab 100644 --- a/ledmatrix.service +++ b/ledmatrix.service @@ -4,9 +4,9 @@ After=network.target [Service] Type=simple -User=%i -WorkingDirectory=/home/%i/LEDMatrix -ExecStart=/usr/bin/sudo /usr/bin/python3 /home/%i/LEDMatrix/display_controller.py +User=root +WorkingDirectory=/home/ledpi/LEDMatrix +ExecStart=/usr/bin/python3 /home/ledpi/LEDMatrix/display_controller.py Restart=on-failure RestartSec=10 StandardOutput=syslog