diff options
author | Alan Mizrahi <alan+crux@mizrahi.com.ve> | 2013-08-07 16:48:20 +0900 |
---|---|---|
committer | Alan Mizrahi <alan+crux@mizrahi.com.ve> | 2013-08-07 16:48:20 +0900 |
commit | ee15297766a9db6c3f397ff29ef2875430e450f5 (patch) | |
tree | 7f57d571365b77b49057a2b2b21f8e838f56325f /bluez/bluetoothd | |
parent | 229f277de2e2d3728396f44b03763f35a36b45fc (diff) | |
download | opt-ee15297766a9db6c3f397ff29ef2875430e450f5.tar.gz opt-ee15297766a9db6c3f397ff29ef2875430e450f5.tar.xz |
bluez: Moved from contrib
Diffstat (limited to 'bluez/bluetoothd')
-rwxr-xr-x | bluez/bluetoothd | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/bluez/bluetoothd b/bluez/bluetoothd new file mode 100755 index 000000000..515f1f934 --- /dev/null +++ b/bluez/bluetoothd @@ -0,0 +1,43 @@ +#!/bin/sh +# +# bluetooth startup script +# + +NAME=bluetoothd +DAEMON=/usr/sbin/bluetoothd + +case $1 in +start) + pid=$(pgrep -f -x $DAEMON) + if [ -n "$pid" ]; then + echo "$NAME is already running with pid $pid" >&2 + exit 1 + fi + $DAEMON + ;; +stop) + pid=$(pgrep -f -x $DAEMON) + if [ -z "$pid" ]; then + echo "$NAME is not running" >&2 + exit 1 + fi + kill $pid + t=0 + while [ -d /proc/$pid -a $t -lt 10 ]; do + sleep 0.5 + let t++ + done + if [ -d /proc/$pid ]; then + echo "$NAME still running with pid $pid" >&2 + exit 1 + fi + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 [start|stop|restart]" >&2 + exit 1 + ;; +esac |