Skip to main content
edited title
Link
Steve Robillard
  • 34.9k
  • 18
  • 104
  • 109

boot time start up code on Raspberry pi 3 jessie by addigadding script under init.d

Source Link

boot time start up code on Raspberry pi 3 jessie by addig script under init.d

to run a script at start-up on my Raspberry pi 3 board ( with jessie lite ) :

1- I added one init script under /etc/init.d/ directory. I can start,stop,restart service using script manually.

### BEGIN INIT INFO
# Provides: LCD
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Liquid Crystal Display
# Description: date / time / ip address
### END INIT INFO
 
 
#! /bin/sh
# /etc/init.d/lcd
 
 
export HOME
case "$1" in
    start)
        echo "Starting LCD"
       /root/Ccodes/charlcd &
    ;;
    stop)
        echo "Stopping LCD"
    killall charlcd
    ;;
    *)
        echo "Usage: /etc/init.d/lcd {start|stop}"
        exit 1
    ;;
esac
exit 0

2-i made the script executable:

"sudo chmod 755 /etc/init.d/lcd"

3-an then Register script to be run at start-up

sudo update-rc.d lcd defaults

the script does not start on boot.

any suggestions?

by the way i can sucsessfully run it at boot using RC.LOCAL https://www.raspberrypi.org/documentation/linux/usage/rc-local.md