sudo nano /etc/rc.local
Add commands below the comment, but leave the line
If your command runs continuously (perhaps runs an infinite loop) or is likely not to exit, you must be sure to fork the process by adding an ampersand to the end of the command, like so:
python /home/pi/myscript.py &
sh /home/pi/myscript.sh &
NOTE: Doesn’t work on cold restart (power down and up)!
sudo nano /etc/init.d/myscript
sudo chmod 755 /etc/init.d/myscript
Note: init.d Scripting is complex!
sudo update-rc.d myscript defaults