aboutsummaryrefslogtreecommitdiffstats
path: root/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'systemd')
-rw-r--r--systemd/mpd.service.in22
-rw-r--r--systemd/mpd.socket9
2 files changed, 31 insertions, 0 deletions
diff --git a/systemd/mpd.service.in b/systemd/mpd.service.in
new file mode 100644
index 000000000..a72eb925c
--- /dev/null
+++ b/systemd/mpd.service.in
@@ -0,0 +1,22 @@
+[Unit]
+Description=Music Player Daemon
+After=network.target sound.target
+
+[Service]
+ExecStart=@prefix@/bin/mpd --no-daemon
+
+# allow MPD to use real-time priority 50
+LimitRTPRIO=50
+LimitRTTIME=-1
+
+# move MPD to a top-level cgroup, as real-time budget assignment fails
+# in cgroup /system/mpd.service, because /system has a zero real-time
+# budget; see
+# http://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime/
+ControlGroup=cpu:/mpd
+
+# assign a real-time budget
+ControlGroupAttribute=cpu.rt_runtime_us 500000
+
+[Install]
+WantedBy=multi-user.target
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