meta-digi-dey: dey-examples: start pulseaudio with 'connectcore-demo' example

The demo now has a "Play music" feature, which requires pulseaudio to be running in the device.
This commit checks if pulseaudio is running before starting the demo, and starts the service in
the case it is not.

Signed-off-by: David Escalona <david.escalona@digi.com>
This commit is contained in:
David Escalona 2022-10-04 10:19:58 +02:00
parent 443b5dbc1d
commit 44a3c1a123
1 changed files with 2 additions and 0 deletions

View File

@ -15,6 +15,7 @@
readonly DEMOSERVER_BINARY="/srv/www/demoserver.py"
readonly STOP_TIMEOUT="5"
readonly PULSEAUDIO_START_COMMAND="pulseaudio --start"
stop_process() {
# try to stop gracefully
@ -30,6 +31,7 @@ stop_process() {
case "$1" in
start)
pkill -0 "pulseaudio" >/dev/null 2>&1 || ${PULSEAUDIO_START_COMMAND}
${DEMOSERVER_BINARY} > /dev/null 2>&1 &
;;
stop)