Created
July 20, 2020 03:24
-
-
Save alien18331/11bc11d1abf55735d0ef78f6e5f891c4 to your computer and use it in GitHub Desktop.
RPI4 auto start on boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# execute on background | |
1. create folder "autostart" | |
create a file named xxx.desktop in /home/pi/.config/autostart/ | |
$ cd /home/pi/.config | |
$ mkdir autostart | |
2. create file "xxx.desktop" | |
content as following | |
[Desktop Entry] | |
Name=ScanTest | |
Comment=My Python Program | |
Exec=python3 /home/pi/example.py | |
Terminal=false | |
MultipleArgs=false | |
Type=Application | |
Categories=Application;Development; | |
StartupNotify=true | |
3. reboot | |
# execute on terminal window | |
use bash to execute python | |
1. create bash file named autostart.sh | |
====================== | |
#!/bin/bash | |
cd /home/pi | |
python3 example.py | |
====================== | |
$ sudo chmod +x autostart.sh | |
2. | |
$ cd /etc/xdg/lxsession/LXDE-pi | |
$ sudo nano autostart | |
add line | |
@lxterminal --command="/home/pi/autostart.sh" | |
Ctrl + X, Y, enter to save file | |
$ reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment