How to Run a Raspberry Pi Program on Startup

Contributors: Shawn Hymel
Favorited Favorite 21

Resources and Going Further

As with most things Linux, there is often more than one way to accomplish a task. This tutorial showed you three different methods for starting programs (or scripts) on boot. All three should come default with Raspbian, which means each of the methods should work with a full Raspbian installation. If you use another operating system (or Raspbian Lite), you might find that only some of the methods are available, so pick what works for you!

If you would like to dig deeper into each of the methods, please see the following documentation:

  • rc.local is part of a larger rc tool suite that you can use to schedule tasks on boot
  • autostart comes with the LXDE desktop environment in Raspbian. Other environments might have a different application starter tool.
  • systemd is a suite of tools used to start various tasks in Linux

There are also plenty of other Linux tools out there to help you start a task on boot. If none of the above three work for you, we recommend checking out:

  • SysVinit is a legacy method for running programs on boot
  • crontab is used to schedule tasks that run regularly (e.g. once per day at a particular time)
Python Logo

Looking for more inspiration? Check out these other Raspberry Pi projects:

Building Large LED Installations

Learn what it takes to build large LED installations from planning to power requirements to execution.

Bark Back Interactive Pet Monitor

Monitor and interact with pets through this dog bark detector project based on the Raspberry Pi!

Raspberry Pi Zero Helmet Impact Force Monitor

How much impact can the human body handle? This tutorial will teach you how to build your very own impact force monitor using a helmet, Raspberry Pi Zero, and accelerometer!

Using Flask to Send Data to a Raspberry Pi

In this tutorial, we'll show you how to use the Flask framework for Python to send data from ESP8266 WiFi nodes to a Raspberry Pi over an internal WiFi network.

Headless Raspberry Pi Setup

Configure a Raspberry Pi without a keyboard, mouse, or monitor.

Setting up a Raspberry Pi 3 as an Access Point

This guide will show you how to configure a Raspberry Pi as an access point and connect it to your local Ethernet network to share Internet to other WiFi devices.

How to Use Remote Desktop on the Raspberry Pi with VNC

Use RealVNC to connect to your Raspberry Pi to control the graphical desktop remotely across the network.

Graph Sensor Data with Python and Matplotlib

Use matplotlib to create a real-time plot of temperature data collected from a TMP102 sensor connected to a Raspberry Pi.