Learning why a Shell Script is not run in boot sequence – Troubleshooting in Raspberry Pi Development

What I want to achive

(but did not so far…)

I want a Raspberry Pi to automatically run a slideshow after the boot sequence.

How I thought I’d do that

I have a working shell script that launches the slideshow:

#!/bin/bash
sudo fbi -T 1 -noverbose -a -t 2 PathToMyPictures/*

I added a new service to /etc/init.d to be run when the machine boots:

#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides:          slideshow
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: runs slideshow on start
# Description:       This file automatically runs a slideshow script found at /home/pi/slideshow/slideshow.sh
### END INIT INFO
# Author: Johannes Kalt <my@mailaddr.es>
sudo /home/pi/slideshow/slideshow.sh

I set the rights for this file to 755 using:

sudo chmod 755 /etc/init.d/flickrd

I added the necessary links using update-rc.d as:

update-rc.d flickrd defaults

What is happening

In the boot sequence the shell script is run as I get a message of the slideshow program fbi stating PathToMyPictures/* loading FAILED.

When I manually start the script using sudo /etc/init.d/MyService start the script is run thus the slideshow shown.

Resources I’ve been using to find an answer (but did not so far)

https://debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian

in German:

Raspberry Pi: Autostart von Programmen einrichten

http://www.forum-raspberrypi.de/Thread-tutorial-automatisches-starten-von-scripte-programme-autostart

I’ll be happy to read your comments and thoughts to get on with my troubleshooting!

Leave a Reply

Your email address will not be published. Required fields are marked *

two × two =