Reputation: 43
First, I apologize for my bad English and now my problem : at the moment I try that my python script camera.py should autostart after the boot has been finished.
However, I tried using rc.local, .bashrc and init.d but nothing will work. Does someone have a better solution, so my script autostarts.
Here you can see the line that I add in my rc.local. Before this line are only blue comments
sudo python /home/pi/Desktop/camera.py &
exit 0
Here is the .bashrc that I used. I only add on the last line of .bashrc those two lines:
echo Running at boot
sudo python /home/pi/Desktop/camera.py
Upvotes: 0
Views: 1142
Reputation: 760
Are you sure that it has been added to the end of the .bashrc
?
1.Make sure you are in the pi folder:
$ cd ~
2.To open up .bashrc for configuration:
$ sudo nano .bashrc
Scroll down to the bottom and add the line: python ~/Desktop/camera.py
Save and exit: Ctrl+X, Y, Enter
then reset your pi
Upvotes: 1
Reputation: 943
You should try setting it as a chron job. Check this out: https://www.ostechnix.com/a-beginners-guide-to-cron-jobs/
This will make it run independent of your user login to a shell. Specifically, look at the @reboot
section.
Upvotes: 1