pulseaudio: let systemd know the PID of the pulseaudio daemon

Otherwise, systemd will have to guess the PID of the service's main process.
It guesses right most of the time, but sometimes it chooses the PID of the
original pulseaudio process instead of the daemon that gets forked off. This
caused the daemon to stop immediately after starting, breaking other apps that
require the pulseaudio server to be running.

Since the PID file is created in a user-specific runtime directory (and the
service is meant for the whole system), modify the wrapper script to create
a symlink to the PID file in a place where it can be obtained by systemd.

https://jira.digi.com/browse/DEL-6795

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2019-10-03 17:04:24 +02:00
parent d95a05f5fc
commit 624a728ff2
2 changed files with 4 additions and 0 deletions

View File

@ -9,3 +9,6 @@
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
pulseaudio --start
# Create a symlink to the daemon's PID file in a more accesible directory
ln -sf $XDG_RUNTIME_DIR/pulse/pid /run/pulse.pid

View File

@ -4,6 +4,7 @@ After=dbus.service
[Service]
Type=forking
PIDFile=/run/pulse.pid
ExecStart=/etc/pulseaudio-init
ExecStop=kill -HUP $MAINPID