-1

I have a number of sensors connected to my pi 3 and i put the python scripts (7 of them) that starts the sensors at boot in the /etc/profile/ folder.. Of the 7 scripts, i noticed that only the scripts that turns on a led and the 16x2 lcd runs at startup no matter where i put the scripts, (be it rc.local or chrontab) the other scripts that should startup my ldr, mq5, dht11, pir sensors do not run at startup.

I also should not fail to mention that the problem started after i used the "kill all python" command one day. While i was trouble shooting this issue i backed up my sd card and re-flashed an earlier image of my sd card and all the scripts booted with the pi. But the thing is i do not want to have to start my project all over again. How can i force all scripts to startup with my pi?

  • EDITED What i'm saying is that i put 7 python scripts in /etc/profiles/ to run at startup. only 3 of the 7 scripts initiate at startup. I want to know the reason why and how to fix this. I also tried 3 other ways of running a script at startup but only 3 scripts end up starting with the pi. 4 fail to launch.

1 Answers1

1

To make your python script run at startup, you should write something like this in your rc.local files.

open file editor with your inbuilt software like, nano /etc/rc.local

sudo /root/abc.py (Note: here abc.py file is in root directory).

MatsK
  • 2,882
  • 3
  • 17
  • 22
Meet Adhia
  • 11
  • 2