How to configure an auto-boot launcher script for Raspberry Pi4

It can be useful for demos and applications to be configured so that they auto run the Storyboard application on boot.

For the this example the autostart mechanism is best achieved using systemd on my Rapberry Pi4 running PiOS 64bit.

It is a default install straight from the Pi Imager and stock PiOS image - here is the initial console output regarding version etc:

Linux raspberrypi4 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Jan 12 12:55:38 2024

SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspberrypi4:~ $

I have the Pi booting to the console ( :

pi@raspberrypi4:~ $sudo systemctl set-default

I am auto-logging in as user 'pi' therefore I have installed all the storyboard runtime and applications under my /home/pi/Crank folder.

I created the script which I want to start a specific Storyboard demo application on start-up as follows (launches my demo apps/Espresso_Demo/Espresso_demo_001.gapp) to use the OpenGL accelerated runtime:

NOTE: All paths must be absolute as the service will be executing from a different system location on startup


export RUNTIME=/home/pi/Crank/runtime/linux-raspberry-aarch64-opengles_2.0-drm-obj
#export RUNTIME=/home/pi/Crank/runtime/linux-raspberry-aarch64-swrender-obj
export SBENGINE=$RUNTIME/bin/sbengine export SB_PLUGINS=$RUNTIME/plugins
export XDG_RUNTIME_DIR=/run/user/0
export SB_APP=/home/pi/Crank/apps/Espresso_Demo/Espresso_demo_001.gapp
#export DISPLAY=:0
export OPTIONS=-vvv

# Change this to slay -f sbengine on QNX systems,
# or the appropriate command to take down running applications for the system
killall sbengine

$SBENGINE $OPTIONS -omtdev,device=/dev/input/event0 -orender_mgr,fullscreen,scale $SB_APP

I then also created a service to auto launch the script on startup as follows:


Description=Storyboard Launcher Service

Type=idle ExecStart=/home/pi/Crank/


[Optional] For convenience I like to keep the physical service and launcher script files located in my Crank folder so I created a symlink of the service instead in the systemd/service path but you could just position the service directly there:

pi@raspberrypi4:~ $sudo ln -s /home/pi/Crank/storyboard_launcher.service /etc/systemd/system/storyboard_launcher.service

Next these files have permissions that need to be set to enable execution:

pi@raspberrypi4:~ $sudo chmod 744 /home/pi/Crank/

pi@raspberrypi4:~ $sudo chmod 664 /home/pi/Crank/storyboard_launcher.service

We can now install the launcher service and setup the script to be auto-started on boot:

pi@raspberrypi4:~ $sudo systemctl daemon-reload

pi@raspberrypi4:~ $sudo systemctl enable storyboard_launcher.service

Created symlink /etc/systemd/system/ ? /home/pi/Crank/storyboard_launcher.service.

The script should be ready to run and should start automatically on reboot but you can start this from a terminal console and use status to check it is working correctly:

pi@raspberrypi4:~ $ sudo systemctl start storyboard_launcher.service

pi@raspberrypi4:~ $ sudo systemctl status storyboard_launcher.service

? storyboard_launcher.service - Storyboard Launcher Service 
     Loaded: loaded (/home/pi/Crank/storyboard_launcher.service; enabled; vendor preset: enabled) 
     Active: active (running) since Fri 2024-01-12 13:03:02 GMT; 8s ago 
   Main PID: 980 (storyboard_demo) 
      Tasks: 6 (limit: 3933) 
        CPU: 2.069s 
     CGroup: /system.slice/storyboard_launcher.service 
             tq980 /bin/bash /home/pi/Crank/ 
             mq982 /home/pi/Crank/runtime/linux-raspberry-aarch64-opengles_2.0-drm-obj/bin/sbengine -vvv -omtdev device=/dev/input/event0 -orende>

If you wish to stop the service (kills the storyboard instance) or disable the autostart of the service you can use the following:

pi@raspberrypi4:~ $ sudo systemctl stop storyboard_launcher.service

pi@raspberrypi4:~ $ sudo systemctl disable storyboard_launcher.service

Removed /etc/systemd/system/ 
Removed /etc/systemd/system/storyboard_launcher.service.

Thats it! Hopefully your Storyboard application will auto-start automatically on every software reboot or power cycle.

Was this article helpful?
0 out of 0 found this helpful