Search code examples
linuxraspberry-pistartupraspbianraspberry-pi2

Run Script on Startup with Raspbian Jessi Wheezy and Raspberry Pi2b


I know there are lots of posts on this topic, but depite working through many many many of them I cant get this working.

I have a raspberry pi2b with raspbian jessie wheezy.

I want to run this framebuffer command automatically on startup:

sudo /usr/bin/fbi -T 1 -t 1 -1 -a -noverbose /home/pi/Pictures/*.jpg


I initially edited rc.local and into it I tried each of these commands but nothing happened on startup:

sudo /usr/bin/fbi -T 1 -t 1 -1 -a -noverbose /home/pi/Pictures/*.jpg

and

sudo fbi -T 1 -t 1 -1 -a -noverbose /home/pi/Pictures/*.jpg


so then I created a script called script_auto_run in my /home/pi/projects/test folder containing the following code:

#!/bin/bash
# Script to start our application
sudo /usr/bin/fbi -T 1 -t 1 -1 -a -noverbose /home/pi/Pictures/*.jpg

into rc.local I placed

sudo /home/pi/projects/test/script_auto_run

Again nothing happens on startup


So then I re-created my script_auto_run file in my /etc/init.d folder and its contents are as follows:

#!/bin/bash
# /etc/init.d/script_auto_run
### BEGIN INIT INFO
# Provides:          servoblaster
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This service is used to manage a servo
### END INIT INFO
sudo /usr/bin/fbi -T 1 -t 1 -1 -a -noverbose /home/pi/Pictures/*.jpg
exit 0

I ran the sudo chmod +x /etc/init.d/script_auto_run command and then edited my rc.local yet again to the following line:

sudo /etc/init.d/script_auto_run

None of these are working. I can run rc.local or script_auto_run from the terminal manually and there is no problem. But they are not executing automatically on startup. Raspbian is just booting to the GUI as normal.


Solution

  • I suggest to follow this http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/custom-boot-up-screen. It works for me and it's easy. Hope it helps