From here (at the bottom)…

/etc/rc.local is a script on the Raspberry Pi which runs when Linux first boots. To edit it, you will need root privileges:

sudo nano /etc/rc.local

If you want to run one of your Python scripts at start-up, add this to the end of rc.local:


To stop a script running, either delete the line it is on, or comment it out (add a # at the beginning of the line).

Alternative method by creating an initialisation script in /etc/init.d and registering it using update-rc.d here.