0

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 https://www.raspberrypi.org/documentation/linux/usage/rc-local.md – jrel Dec 04 '20 at 17:54
  • 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: https://raspberrypi.stackexchange.com/questions/33817/use-boot-cmdline-txt-for-creating-first-boot-script – Abel Dec 04 '20 at 19:14
  • @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 Dec 05 '20 at 20:51
  • @user127471 You should use a systemd Unit file. – Ingo Dec 05 '20 at 20:53
  • @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. – jrel Dec 08 '20 at 14:41

0 Answers0