Skip to content

Instantly share code, notes, and snippets.

@kristianpedersen
Last active November 10, 2020 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristianpedersen/9c8e3dc6501070eecd1431e0d585b781 to your computer and use it in GitHub Desktop.
Save kristianpedersen/9c8e3dc6501070eecd1431e0d585b781 to your computer and use it in GitHub Desktop.
Raspberry Pi: Launch script on startup

Install xterm + .desktop file

https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup#method-2-autostart

First, install xterm:

sudo apt install xterm -y

Then, if it doesn't already exist, create this folder:

mkdir /home/pi/.config/autostart

Lastly, create this file with the contents below:

sudo nano /home/pi/.config/autostart/startup.desktop

[Desktop Entry]
Type=Application
Name=Your name
Exec=xterm -hold -e '/usr/bin/python3 /home/pi/Desktop/_your_script.py'

Save and exit: CTRL+X -> Y -> Enter

sudo reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment