diff --git a/Makefile.am b/Makefile.am
index b8a709c07..8cf8ec5ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1250,6 +1250,7 @@ FILTER_LIBS = \
if HAVE_SYSTEMD
systemdsystemunit_DATA = \
+ systemd/mpd.socket \
systemd/mpd.service
endif
diff --git a/NEWS b/NEWS
index c1def0786..d88d6da08 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,7 @@ ver 0.19 (not yet released)
- name each thread (for debugging)
* new resampler option using libsoxr
* allow playlist directory without music directory
+* install systemd unit for socket activation
ver 0.18.8 (2014/02/07)
* decoder
diff --git a/doc/user.xml b/doc/user.xml
index dc9d913e7..ba35bfa5b 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -135,29 +135,18 @@ apt-get install g++ automake autoconf \
Using systemd, you can launch
mpd on demand when the first client
- attempts to connect. Create two files in
- /etc/systemd/system/; first
- mpd.socket:
+ attempts to connect.
- [Socket]
-ListenStream=/run/mpd.socket
-ListenStream=6600
-[Install]
-WantedBy=sockets.target
-
- Now create mpd.service:
+ MPD comes with two systemd unit files: a
+ "service" unit and a "socket" unit. These will only be
+ installed when MPD was configured with
+ --with-systemdsystemunitdir=/lib/systemd.
- [Unit]
-Description=Music Player Daemon
-After=sound.target
-[Service]
-ExecStart=/usr/bin/mpd --stdout --no-daemon
-
- Start the socket:
+ To enable socket activation, type:
systemctl enable mpd.socket
diff --git a/systemd/mpd.socket b/systemd/mpd.socket
new file mode 100644
index 000000000..c4692592c
--- /dev/null
+++ b/systemd/mpd.socket
@@ -0,0 +1,9 @@
+[Socket]
+ListenStream=/run/mpd/socket
+ListenStream=6600
+Backlog=5
+KeepAlive=true
+PassCredentials=true
+
+[Install]
+WantedBy=sockets.target