πŸ“¦ 7. Raspberry Pi – Software Management
Estimated reading: 4 minutes 432 views

Raspberry Pi – Manage Startup Applications (2025 Boot Automation Guide)


Introduction – Run Apps Automatically on Raspberry Pi Boot

Whether you’re building a kiosk display, launching a sensor monitoring script, or auto-starting a web server, managing startup applications on Raspberry Pi ensures your services or scripts run automatically after bootβ€”without manual intervention.

In this guide, you’ll learn:

  • How to auto-run Python scripts, apps, or services on Raspberry Pi
  • Use methods like rc.local, cron, systemd, and .desktop files
  • Best practices to ensure stability, logging, and recovery
  • Example use cases: web server, LED controller, GUI apps

Method 1: rc.local (Legacy Boot Script – CLI or Lite Mode)

Step 1: Edit the rc.local file

sudo nano /etc/rc.local

Step 2: Add your command before exit 0

Example (Python script):

python3 /home/pi/startup/blink.py &

The & lets it run in background.

Works on Raspberry Pi OS Lite, but deprecated in newer OS releases. Use systemd for long-term reliability.


️ Method 2: Cron @reboot (Simple & Lightweight)

Step 1: Edit cron jobs

crontab -e

Step 2: Add this line at the end

@reboot python3 /home/pi/startup/weather.py >> /home/pi/logs/weather.log 2>&1

This logs all output into weather.log and runs your Python script every time Pi boots.


Method 3: systemd Services (Best for Services or Daemons)

Step 1: Create a service file

sudo nano /etc/systemd/system/myscript.service

Step 2: Add the following:

[Unit]
Description=My Python Script at Boot
After=network.target

[Service]
ExecStart=/usr/bin/python3 /home/pi/startup/monitor.py
WorkingDirectory=/home/pi/startup
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

Step 3: Enable and start

sudo systemctl daemon-reexec
sudo systemctl enable myscript.service
sudo systemctl start myscript.service

Use this method for background services, network wait, or restart-on-failure apps.


Method 4: Autostart GUI Apps (for Desktop Mode)

If you want a Python GUI, browser, or kiosk app to launch at login:

Step 1: Create a .desktop file

nano ~/.config/autostart/myapp.desktop

Step 2: Add:

[Desktop Entry]
Type=Application
Name=MyApp
Exec=python3 /home/pi/gui/clock.py

Works only if Pi boots into GUI (PIXEL/Desktop environment).


Comparison Table – Startup Method Use Cases

Method Best For Boot Mode Restart Capable
rc.localCLI-based one-liners/scriptsHeadless (Lite) No
cron @rebootSimple tasks, no monitoringAll No
systemdServices, servers, GPIO appsAll Yes
.desktop filesGUI apps, browsers, PyQt appsDesktop Only No

Real-World Use Cases

Project Startup Method
Sensor data loggercron or systemd
Flask web serversystemd
OLED display controllerrc.local or systemd
Chromium kiosk mode browser.desktop + GUI
MQTT listener servicesystemd
LED blinking scriptcron or rc.local

Summary – Recap & Next Steps

You can make your Raspberry Pi automatically launch scripts, servers, GUI tools, or background services with easeβ€”improving automation, uptime, and headless functionality.

Key takeaways:

  • Use systemd for services with logging and restart support
  • Use cron for lightweight boot tasks
  • Use .desktop for graphical startup on GUI login
  • Use rc.local for quick one-line startup (legacy)

Real-world relevance: Ideal for IoT projects, smart home setups, data logging, media servers, and unattended applications.


FAQs – Raspberry Pi Startup Applications

My script runs but fails silently at boot. Why?

Most likely missing environment paths or permissions. Log output to a file or use systemd for better error handling.


How can I delay a script after boot?

Add sleep in cron or systemd like:

ExecStart=/bin/bash -c 'sleep 10 && python3 /path/to/app.py'

Can I run multiple apps on boot?

Yes. Use multiple @reboot lines, .desktop files, or separate systemd units.


What happens if my systemd service crashes?

Add Restart=always or on-failure to restart the service automatically.


How to remove a service I added?

sudo systemctl disable myscript.service
sudo rm /etc/systemd/system/myscript.service

Share Now :
Share

πŸ› οΈ Raspberry Pi – Manage Startup Applications

Or Copy Link

CONTENTS
Scroll to Top