Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have a raspberry pi zero w and I need to add a python script to startup just by editing the files in boot unit, instead of adding a line to cron using terminal.
Thanks for help.
Not sure what you mean by "boot unit" but if you are just tying to get a program to run when the pi boots by simply editing a file, maybe try rc.local? Take a look at raspberrypi.org/documentation/linux/usage/rc-local.md
boot unit likely means the fat32 boot partition on sd. to do this can involve calling something on boot from rc.local or other means, or replacing init to do extra stuff if strictly limited to boot of default image: raspberrypi.stackexchange.com/questions/33817/…
@jrel Please never suggest to use rc.local anymore. Even the link have a "NOTE:". Please respect it. Using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it.
@Ingo While I agree that in general (and for anything you want to be robust) you should avoid using rc.local. That being said, I've used rc.local on my Pi for simple small projects when I want something quick and dirty during testing for example. IMO, we should not censor the simplest solution just because it's not ideal.
rc.local
anymore. Even the link have a "NOTE:". Please respect it. Using/etc/rc.local
has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it.systemd
Unit file.