[systemd-devel] Services with Access to User Sessions

Justin Brown justin.brown at fandingo.org
Mon May 19 11:55:28 PDT 2014


I'm having some difficulty setting up a systemd service that needs
access to a "user session" (probably not the correct term). I want to
configure shairport as a systemd service. Shairport is an open source
implementation of Apple's AirPlay and is used to play audio from an
iOS device on a Linux computer. As such, it needs access to
PulseAudio. This is where I'm having trouble.

I have a basic shairport.service file setup, and it correctly starts,
but it does not seem to connect to PulseAudio because there is no
audio output, even though the iOS device shows that audio is being
transmitted.

[Unit]
Description=Shairport AirTunes receiver
After=sound.target
Requires=avahi-daemon.service
After=avahi-daemon.service

[Service]
ExecStart=/usr/local/bin/shairport -v
Restart=always

[Install]
WantedBy=multi-user.target

I need some help addressing two points.

1) What do I need to change to allow this service to connect to
PulseAudio in my desktop session?
2) Following on #1, how can I start this application only once a user
logs in (i.e. PulseAudio can play audio)?

Thanks,
Justin


More information about the systemd-devel mailing list