#! /bin/sh

test -x /usr/bin/mobile || exit 0

case "$1" in
  start)
    echo -n "Starting mobile: "
    #usb_daemon will drop root priviledges after binding
    start-stop-daemon -S -b -a /usr/bin/mobile
    echo "mobile started."
    ;;
  stop)
    echo -n "Stopping mobile: "
    start-stop-daemon -K -n mobile
    echo "mobile stopped."
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage mobile { start | stop | restart }" >&2
    exit 1
    ;;
esac

exit 0
