How to Run a Raspberry Pi Program on Startup
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)
Looking for more inspiration? Check out these other Raspberry Pi projects: