We'll learn how to Auto Run Python Program on Startup. In the end, we'll Power-up Raspberry Pi using Power Bank to automate running python script on boot. We can learn how stand alone product run python program. So we don't need to use terminal and run python script manually.
How to run a python script on Raspberry Pi Boot (4-STEP PROCESS)
sudo raspi-config
Select “Boot Options” then “Desktop/CLI” then “Console Autologin”
In the command prompt or in a terminal window type:
sudo nano /etc/profile
Scroll to the bottom and add the following line
sudo python /home/pi/brightness.py &
where “/home/pi/brightness.py” is the path to your script.
Type “Ctrl+X” to exit, then “Y” to save followed by “Enter” twice.
sudo reboot
Ещё видео!