How to Auto execute the GoPiGo../robot_web_server.py


#1

Hi.
I have almost finihsed my project.
I wondered how to auto execute the Python p/g when Raspberry pi reboot status.
I’m now testing robot_web_server.py
And I have also executed “chmod +x robot_web_server.py”

Let me know how to auto execute “robot_web_server.py” file when the Raspberry Pi reboot status.

I’m looking forward to your reply.
Have a good day.
Lucid


#2

Hi Lucid,
There are a lot of posts on how to run a program on boot. Here are couple of posts: http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs , http://raspberrywebserver.com/serveradmin/run-a-script-on-start-up.html , http://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/ http://raspberrypi.stackexchange.com/questions/8734/execute-script-on-start-up. You should be able to start the robot web server at boot and should be able to control the GoPiGo.

-Karan


#3

Maybe the most robust way to do this is to modify the crontab file. There’s a great tutorial on how to do this here:

http://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/


#4

Then edit the rc.local file (command to use)
~sudo nano /etc/rc.local
This opens the rc.local file in nano text editor

After initial comments in the rc.local file the first line the computer can read should be
~sudo /home/pi/projects/my-project.a &

.a would be the file type I believe

& symbol tells it to run in background

Save by pressing ctrl+x then press Y enter

End program with
~sudo killall my-project.a