You are not allowed to use commands in systemd
services.:
The command to execute must be an absolute path name. Source: systemd.service
You should add the exact path of the command. You can find that by this command:
which python
You would get the output as it:
/usr/bin/python
Finally, use the output of which
command to your systemd
service.
It should be something like this:
ExecStart=/usr/bin/python /home/pi/Desktop/startupBrowser.py
How to simply create a systemd
service?
Create a file:
nano /etc/systemd/system/startupbrowser.service
Put all lines below there:
[Unit]
Description=startupbrowser service
[Service]
ExecStart=/usr/bin/python /home/pi/Desktop/startupBrowser.py
StandardOutput=syslog
StandardError=syslog
Restart=on-failure
User=root
Group=root
SyslogIdentifier=startupbrowser
[Install]
WantedBy=multi-user.target
Save the file and reload the daemon:
sudo systemctl daemon-reload
Test that is your code is running:
sudo service startupbrowser start
Check the log by:
journalctl -f -u startupbrowser.service
It will give you the real-time log of your python code to troubleshoot what's going on.
If everything was good as you intended, run this command to enable is as a startup service:
sudo systemctl enable startupbrowser.service
/usr/bin/python
.