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.

5
  • 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
    Commented 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
    Commented 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
    Commented Dec 5, 2020 at 20:51
  • @user127471 You should use a systemd Unit file.
    – Ingo
    Commented 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
    Commented Dec 8, 2020 at 14:41

0

Your Answer

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

Browse other questions tagged or ask your own question.