How to Execute a Script at Startup on the Raspberry Pi

Thứ sáu - 26/04/2024 23:11
Whether it be used as a media center, web server, gaming console, or simply a computer, there are countless reasons why you might need a particular program or script to automatically start when you boot your Raspberry Pi. This wikiHow...
Table of contents

Whether it be used as a media center, web server, gaming console, or simply a computer, there are countless reasons why you might need a particular program or script to automatically start when you boot your Raspberry Pi. This wikiHow teaches you how to force a script to start at boot time by either adding it as a service (before the desktop loads), or by adding it to your autostart file (after the desktop loads).

Method 1
Method 1 of 2:

Adding a Script as a Service

  1. Advertisement
Method 2
Method 2 of 2:

Using the Autostart File

  1. 5
    Include the full paths to every filename. For example, to run a Python script that requires superuser permissions called "myscript.py" which is located in the home directory of the user "pi", you would enter the full path to both the Python script itself and the Python interpreter, such as sudo /usr/bin/python /home/pi/myscript.py.
  2. Advertisement

Total notes of this article: 0 in 0 rating

Click on stars to rate this article