You are not logged in.

#1 2013-04-05 17:31:26

Registered: 2013-04-05
Posts: 2

Setting up MPD for every user on the machine

I'm having a few problems setting up MPD. What I want to do is configure MPD such that it starts automatically at login using the current user config file (so that it uses the correct db) and stops playing and exit (to free port 6600) on logout. This way when a different user logs in MPD will use the correct database and playlists dir.

So far I've created all the needed files (.mpd/{.conf,.pid,etc}) in the home dirs of every user and followed this (MPD/Autostart with systemd/Current Setup) then I followed these steps for user1 (created the needed files in user1's home) Using systemd to manage your session (Should I repeat them for user2?). I'm using this service for mpd:

Description=Music Player Daemon

ExecStart=/usr/bin/mpd %h/.config/mpd/mpd.conf --no-daemon
ExecStop= /usr/bin/mpd %h/.config/mpd/mpd.conf --kill  #I expected this to stop mpd on logout


The problem is that when I log out the music keeps playing which means mpd is still running. If I log in as user2 I can see users1 database (using ncmpc) but I can't control the playback e.g:If I want to skip the current track it stops playing.

Any ideas?


#2 2013-04-05 17:40:38

Registered: 2011-10-22
Posts: 1,213

Re: Setting up MPD for every user on the machine

rodrigomb81 wrote:

ExecStop= /usr/bin/mpd %h/.config/mpd/mpd.conf --kill  #I expected this to stop mpd on logout

That will stop mpd when the service is stopped, which will happen when the user instance of systemd exits. So logout should do `systemctl --user exit`. (This might be mentioned on the wiki, but that systemd/user page is a big mess.)


Board footer

Powered by FluxBB