The preferred way to do this nowadays is via the systemd service. Begin by creating a unit file for this service…

sudo nano /lib/systemd/system/cube.service

(Substitute your editor of preference in place of nano if you like.)

Copy-and-paste the following into the new file, editing the “ExecStart” line to reference which of the programs you’d like to run. Can also change the directory name, if you’ve moved or called it something else:

Description=Cube Service

ExecStart=/usr/bin/python /home/pi/Pi_Matrix_Cube/ -k 1


When running programs in a service like this, it’s best to specify full, absolute pathnames for everything. In the example above, that includes python and the script name. If specifying images for the image viewer or globe programs, those should have a full path to the image files too.

Save this file and exit the editor.

A few commands then enable this new service and will launch it on startup:

sudo systemctl daemon-reload
sudo systemctl enable cube.service
sudo reboot

To change which program is loaded on startup, just edit /lib/systemd/system/cube.service and change the ExecStart line, and reboot. No need to repeat the systemctl commands.

This guide was first published on May 04, 2022. It was last updated on Mar 08, 2024.

This page (Auto-Start on Boot) was last updated on Mar 08, 2024.

Text editor powered by tinymce.