#!/usr/bin/env sh


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=camera-background
DESC="Enable/Disable camera background service"
PID=/var/run/camera.pid
APP=/home/root/biosmart/camera
APP_ARG="--udp-loopback"


case "$1" in
  start)
    echo -n "Enable $NAME"
    start-stop-daemon --start --quiet --pidfile $PID --make-pidfile --exec $APP -- $APP_ARG &
    echo ".....[OK]"

    ;;
  test)
    echo -n "Enable test-mode $NAME"
    start-stop-daemon --start --quiet --pidfile $PID --make-pidfile --exec $APP &
    echo ".....[OK]"

    ;;
  stop)
    echo -n "Disable $NAME"
    start-stop-daemon --stop --quiet --pidfile $PID
    echo ".....[OK]"

    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|test|restart}"
    exit 1
esac

exit 0
