I am trying to start a Python3 script on boot. The script listens to a 433 MHz receiver for remote button presses, then publishes an mqtt message for matching button codes.
The python code works just fine from the command line:
python3 /home/pi/433/433rcv.py
When I run:
systemctl status 433rcv.service
I get lots of errors:
pi@raspberrypi:/lib/systemd/system $ systemctl status 433rcv.service
? 433rcv.service
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Jul 17 10:53:13 raspberrypi systemd[1]: 433rcv.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jul 17 10:54:49 raspberrypi systemd[1]: [/lib/systemd/system/433rcv.service:1] Unknown section 'unit'. Ignoring.
Jul 17 10:54:49 raspberrypi systemd[1]: [/lib/systemd/system/433rcv.service:5] Unknown section 'service'. Ignoring.
Jul 17 10:54:49 raspberrypi systemd[1]: 433rcv.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jul 17 11:00:56 raspberrypi systemd[1]: [/lib/systemd/system/433rcv.service:1] Unknown section 'unit'. Ignoring.
Jul 17 11:00:56 raspberrypi systemd[1]: [/lib/systemd/system/433rcv.service:5] Unknown section 'service'. Ignoring.
Jul 17 11:00:56 raspberrypi systemd[1]: 433rcv.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jul 17 11:02:22 raspberrypi systemd[1]: [/lib/systemd/system/433rcv.service:1] Unknown section 'unit'. Ignoring.
Jul 17 11:02:22 raspberrypi systemd[1]: [/lib/systemd/system/433rcv.service:5] Unknown section 'service'. Ignoring.
Jul 17 11:02:22 raspberrypi systemd[1]: 433rcv.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
I have little experience writing services files. While I appreciate the flexibility of the systemd method, it sure does make it difficult to start a script on boot.
Here is my services file:
[unit]
Description=Run the 433Mhz Receiver
After=multi-user.target
[service]
type=idle
ExecStart=/usr/bin/python3 /home/pi/433/rcv.py -q &
[Install]
WantedBy=multi-user.target
So, if anyone can see my problem, assistance would be greatly appreciated. (Extra info: I ran dos2unix to make sure that wasn't the problem. No difference).