#!/bin/bash NAME=bt-pan SERVER=/usr/libexec/bluetooth/${NAME} PYTHON=$(readlink -f /usr/bin/python2) BRIDGE=pan0 DNAME="${NAME}.${BRIDGE}" PIDFILE="/run/${DNAME}.pid" ENABLED=yes [ -f /etc/default/$NAME ] && . /etc/default/$NAME if [ "$ENABLED" != "yes" ]; then echo "$NAME: disabled in /etc/default" exit fi case $1 in start) echo "Starting ${DNAME}" /usr/sbin/start-stop-daemon -S -p ${PIDFILE} -x ${PYTHON} -b -- ${SERVER} ${PANOPTS} server $BRIDGE ;; stop) /usr/sbin/start-stop-daemon -K -p ${PIDFILE} -x ${PYTHON} echo "Stopping ${DNAME}" ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 2 ;; esac