summaryrefslogtreecommitdiff
path: root/recipes-connectivity/bluez/bluez5/rfcomm/init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/bluez/bluez5/rfcomm/init')
-rwxr-xr-xrecipes-connectivity/bluez/bluez5/rfcomm/init39
1 files changed, 39 insertions, 0 deletions
diff --git a/recipes-connectivity/bluez/bluez5/rfcomm/init b/recipes-connectivity/bluez/bluez5/rfcomm/init
new file mode 100755
index 0000000..69455d8
--- /dev/null
+++ b/recipes-connectivity/bluez/bluez5/rfcomm/init
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+NAME=rfcomm
+SERVER=/usr/libexec/bluetooth/${NAME}
+PYTHON=$(readlink -f /usr/bin/python2)
+PIDFILE="/run/${NAME}.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 ${NAME}"
+ echo /usr/sbin/start-stop-daemon -S -p ${PIDFILE} -x ${PYTHON} -b -- ${SERVER} ${RFCOMMOPTS}
+ /usr/sbin/start-stop-daemon -S -p ${PIDFILE} -x ${PYTHON} -b -- ${SERVER} ${RFCOMMOPTS}
+ ;;
+
+ 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
+
+