You are not logged in.

#1 2014-04-12 02:08:15

saturn_knight
Member
Registered: 2010-10-16
Posts: 9

[SOLVED] MPD running locally leaves PID behind on shutdown

I've been having this issue for a while and I'm not sure what's wrong.

My MPD is configured as per the wiki to run as the local user, and I have the following line in .profile

# MPD daemon start (if no other user instance exists)
[ ! -s ~/.config/mpd/pid ] && mpd

When I restart, or shutdown and do a clean start of my system MPD doesn't start because the PID file is left behind from the previous process.

I've tried to simplify the process for testing

1) boot to console
2) start MPD manually
3) execute systemctl reboot

When the system comes back up the old PID file is still there, preventing MPD from autostarting.
Does anyone have any ideas on what might be keeping my system from shutting down the process cleanly?

Last edited by saturn_knight (2014-04-12 07:44:48)

Offline

#2 2014-04-12 02:22:19

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] MPD running locally leaves PID behind on shutdown

Why don't you just start it with a service file and let systemd manage the process?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-04-12 02:35:40

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: [SOLVED] MPD running locally leaves PID behind on shutdown

I agree. Systemd service is the way to go. Once you have a user instance of sytsemd up and running, the service file is quite trivial.

Offline

#4 2014-04-12 07:11:21

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: [SOLVED] MPD running locally leaves PID behind on shutdown

jasonwryan wrote:

Why don't you just start it with a service file and let systemd manage the process?

Maybe because of this: https://bbs.archlinux.org/viewtopic.php?id=178793 (thread also includes the solution for a proper mpd service file)

Last edited by Rasi (2014-04-12 07:12:00)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#5 2014-04-12 07:31:00

cju
Member
Registered: 2013-06-23
Posts: 194

Re: [SOLVED] MPD running locally leaves PID behind on shutdown

Just forget about the pid-thing and write

mpd

instead of

[ ! -s ~/.config/mpd/pid ] && mpd

in your $autostartfile. Sure, that's not the ideal way, but it just works, so I why should I care any further. wink

Offline

#6 2014-04-12 07:41:36

saturn_knight
Member
Registered: 2010-10-16
Posts: 9

Re: [SOLVED] MPD running locally leaves PID behind on shutdown

Thanks for the recommendations. I was tempted to just run MPD without checking for the PID first, but it was bothering me that it used to work and I don't know what changed. Also, the fact that if MPD isn't being shut down cleanly on shutdown what else might be getting shut down in an unclean state?

The thread Rasi pointed to shows the same problem I was experiencing, not sure why it didn't come up in my searches. Apparently there is an issue with MPD not responding to the shutdown signal properly in some situations. Ultimately, I went ahead and switched to the systemd user startup and it's now remembering my playlists and current state between reboots. I guess I was initially hesitant to use it because the wiki states that it's still unsupported upstream, plus I was afraid there might be a more serious underlying problem that might affect other things on my system.

Thanks again!

Offline

#7 2014-04-12 07:42:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] MPD running locally leaves PID behind on shutdown

Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB