blob: af1adab704d7227ac5de43edc0de4b88b3ff979f (
plain)
1 #!/bin/sh
2 #@ bluez-alsa startup script.
3 #@ Likely requires <- bluetoothd [<- dbus]
4
5 RD=/run
6 PID=${RD}/bluealsa.pid
7
8 SSD=/sbin/start-stop-daemon
9 PROG=/usr/bin/bluealsa
10 OPTS="-p a2dp-sink -p a2dp-source -c AAC"
11
12 case "${1}" in
13 start)
14 exec "${SSD}" --start --background --make-pidfile --pidfile "${PID}" \
15 --exec "${PROG}" -- ${OPTS}
16 ;;
17 stop)
18 exec "${SSD}" --stop --remove-pidfile --retry 10 --pidfile "${PID}" \
19 --exec "${PROG}"
20 ;;
21 restart)
22 "${SSD}" --status --pidfile "${PID}" --exec "${PROG}" &&
23 "${0}" stop
24 exec "${0}" start
25 ;;
26 status)
27 "${SSD}" --status --pidfile "${PID}" --exec "${PROG}"
28 e=${?}
29 case ${e} in
30 0) echo "${PROG} is running with pid $(cat ${PID})";;
31 1) echo "${PROG} is not running but the pid file ${PID} exists";;
32 3) echo "${PROG} is not running";;
33 4) echo "Unable to determine the program status";;
34 esac
35 exit ${e}
36 ;;
37 *)
38 echo "usage: ${0} start|stop|restart|status"
39 ;;
40 esac
|