contrib/bluealsa/bluealsa.rc

41 lines
882 B
Plaintext
Raw Normal View History

2020-12-30 22:26:16 +01:00
#!/bin/sh
#@ bluez-alsa startup script.
2021-03-18 19:03:13 +01:00
#@ Likely requires <- bluetoothd [<- dbus]
RD=/run
PID=${RD}/bluealsa.pid
2020-12-30 22:26:16 +01:00
SSD=/sbin/start-stop-daemon
PROG=/usr/bin/bluealsa
OPTS=-S
2021-03-18 19:03:13 +01:00
case "${1}" in
2020-12-30 22:26:16 +01:00
start)
2021-02-08 23:30:38 +01:00
exec "${SSD}" --start --background --make-pidfile --pidfile "${PID}" \
--exec "${PROG}" -- ${OPTS}
2020-12-30 22:26:16 +01:00
;;
stop)
2021-02-08 23:30:38 +01:00
exec "${SSD}" --stop --remove-pidfile --retry 10 --pidfile "${PID}" \
--exec "${PROG}"
2020-12-30 22:26:16 +01:00
;;
restart)
"${SSD}" --status --pidfile "${PID}" --exec "${PROG}" &&
"${0}" stop
2021-02-08 23:30:38 +01:00
exec "${0}" start
2020-12-30 22:26:16 +01:00
;;
status)
2021-02-08 23:30:38 +01:00
"${SSD}" --status --pidfile "${PID}" --exec "${PROG}"
e=${?}
case ${e} in
0) echo "${PROG} is running with pid $(cat ${PID})";;
1) echo "${PROG} is not running but the pid file ${PID} exists";;
3) echo "${PROG} is not running";;
4) echo "Unable to determine the program status";;
2020-12-30 22:26:16 +01:00
esac
2021-02-08 23:30:38 +01:00
exit ${e}
2020-12-30 22:26:16 +01:00
;;
*)
2021-03-18 19:03:13 +01:00
echo "usage: ${0} start|stop|restart|status"
2020-12-30 22:26:16 +01:00
;;
esac