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’.
sudo nano /home/pi/.bashrc
Go to the last line of the script and add:
echo Hello I am running at boot
sudo python /home/pi/mysample.py











