Here comes a good reference:
https://raspberrytips.com/autostart-a-program-on-boot/
Thank you ALL and let's close this topic.
That's not a "good reference". For many reasons:
- init.d is deprecated and should not be used
- So is rc.local and according to at least one report was removed in the November release of RPiOS
- It's lacking details.
- It fails to explain why some things are necessary e.g. "Don’t forget the ampersand(&) symbol at the end, or it might not work!". doesn't explain what the & does.
- It has you creating a custom systemd service in the wrong place. It should be in /etc/systemd/system not /lib/systemd/system/
- "Type=idle" is not appropriate for all services.
- Neither is "After=multi-user.target" and "Wants=multi-user.target"
- Does not cover starting desktop/gui applications.
- No mention of the significant differences between running from cron, rc.local, or systemd and running under a logged in shell.
- No troubleshooting advice. So, as you have found out, when it doesn't work or works in a way you didn't expect you're on your own.
- ...
But I'm biased.
Statistics: Posted by thagrol — Mon Dec 30, 2024 1:20 pm