-
Create a new unit file in
/lib/systemd/system/
calledrpi-lcd.service
:sudo vim /lib/systemd/system/rpi-lcd.service
-
Copy and paste the following in the new unit file:
[Unit] Description=RPi Python script for a 16x2 LCD [Service] Type=simple ## Edit the following according to the script permissions User=root #User=pi #Group=users ## Edit the following with the full path to the compatible Python version and your script ExecStart=/usr/bin/python3 /home/stereosonic/raspi-lcd-16x2/lcd.py Restart=always RestartSec=5 KillMode=process KillSignal=SIGINT [Install] WantedBy=multi-user.target
-
Enable the service and start it:
sudo systemctl enable rpi-lcd.service sudo systemctl start rpi-lcd.service
-
Check that the LCD is displaying the correct information; otherwise, check the service status:
systemctl status rpi-lcd.service