I’m having trouble running a “program” as a service.

I followed these instructions but it still doesn’t work. Is dietpi a different process?

Open another SSH session (Putty or SSH client) and login to the PI.
All following actions must be done on this second SSH login instance!
Setting YAP to run automatically as a service
sudo nano /etc/systemd/system/yap.service
Copy and paste the following on the opened window:

[Unit]
Description=A simple proxy for SSTV and Plex DVR

[Service]
WorkingDirectory=/home/pi/yap
ExecStart=/usr/bin/python3 sstvProxy.py -hl
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Press Ctrl and x together
Press Y to save, and press the enter key again to save the file

Now enable the service so it starts every time you reboot:
sudo systemctl enable yap.service
Now reboot
sudo reboot

Hi,

many thanks for your report. First I guess the home directory doesn’t fit because user pi did not exist on DietPi

WorkingDirectory=/home/pi/yap

Or did you created that user?

did you tried to execute the following manually? Is it working?

/usr/bin/python3 sstvProxy.py -hl

What is the error message you are facing during service start?