Auto start a program on boot
.bashrc method
This will run on boot and also every time when a new SSH connection is made. Put your command at the bottom of ‘/home/pi/.bashrc’.
1 2 3 |
sudo nano /home/pi/.bashrc |
Go to the last line of the script and add:
1 2 3 4 |
echo Hello I am running at boot sudo python /home/pi/mysample.py |