You probably don't want to be futzing with a full keyboard and terminal window to launch this project every time. Luckily you can configure it to run on boot by creating a systemd
unit file that runs the Python script within the Python venv after the desktop environment loads.
File Permissions
To allow for all of the files to run on boot without issue, you'll need to adjust the file permissions before running the systemd
file. Run these commands in the terminal:
chmod +x /home/USERNAME/lumon.py chmod +x /home/USERNAME/data.py chmod +x /home/USERNAME/data_bins.py chmod +x /home/USERNAME/palette.py
Replace USERNAME
with your username on your Raspberry Pi.
Then, run this command for the folder that your saved JSON files are stored:
chmod 755 /home/USERNAME/mdr_saves/
sudo nano /lib/systemd/system/mdr.service
Copy and paste the contents of the text file below into the systemd file:
[Unit] Description=Macrodata Refinement After=multi-user.service [Service] Type=simple PAMName=login User=pi-lumon Group=pi-lumon WorkingDirectory=/home/pi-lumon Environment=DISPLAY=:0 Environment=XAUTHORITY=/home/pi-lumon/.Xauthority ExecStart=/home/pi-lumon/lumon/bin/python /home/pi-lumon/lumon.py Restart=on-failure RestartSec=5s [Install] WantedBy=multi-user.target
Replace "pi-lumon" with the username on your Raspberry Pi. The default is usually "pi".
The file waits for the desktop environment to load and then launches the Python script within the virtual environment. If it fails, it will keep trying every 5 seconds.
Save the file. Then, in a terminal run these commands:
sudo systemctl enable mdr sudo systemctl start mdr
This enables the service and starts it. To test, reboot your Pi. After the desktop environment loads, you should see the script startup automatically with the bouncing Lumon logo.
Page last edited March 04, 2025
Text editor powered by tinymce.