I’ve got a Raspberry Pi with connected camera. When the Pi boots up there should be executed a script which starts the camera software.

You must create an new file in /etc/init.d/ and then add the following content:

# /etc/init.d/startcam

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    /home/pi/start.sh
    ;;
  stop)
    pkill webcam
    echo "stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/startcam {start|stop}"
    exit 1
    ;;
esac

exit 0

then make the file executeable

sudo chmod +x /etc/init.d/startcam

to test your script, you must be shure that it isn’t active

ps -ef | grep webcam

then start the script using

sudo /etc/init.d/startcam start

or just reboot your computer and check once again if your script is active.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert