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
    – jrel
    Dec 4, 2020 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: raspberrypi.stackexchange.com/questions/33817/…
    – Abel
    Dec 4, 2020 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 5, 2020 at 20:51
  • @user127471 You should use a systemd Unit file.
    – Ingo
    Dec 5, 2020 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 8, 2020 at 14:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.