Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 181010 - media-sound/mpd - new /etc/init.d/ script
Summary: media-sound/mpd - new /etc/init.d/ script
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Christoph Mende (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-05 21:16 UTC by Zrajm C Akfohg
Modified: 2009-01-19 00:39 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
new /etc/init.d/mpd (mpd,2.42 KB, text/plain)
2007-06-05 21:27 UTC, Zrajm C Akfohg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zrajm C Akfohg 2007-06-05 21:16:20 UTC
Rewrite of MPD's (music player daemon) init script. Stops mpd by means of "kill" (which works even if MPD is hanged/non-responsive), and allows MPD's niceness to be set.

Reproducible: Always

Steps to Reproduce:




Sometimes MPD hangs on my system (under somewhat elusive circumstances -- which does not seem to be caused by MPD itself, but I have yet to find the exact cause). When hanged MPD become totally unresponsive and thus cannot be terminated by means of "mpd --kill", however killing with "kill" still works -- so this start script uses kill, instead.

Also I found that I needed to be able to specify mpd's niceness (I get lapses/gaps in my music when my computer is under heavy load, unless MPD's niceness is sufficiently low). So I added that too.
Comment 1 Zrajm C Akfohg 2007-06-05 21:27:43 UTC
Created attachment 121288 [details]
new /etc/init.d/mpd

New /etc/init.d/mpd start/stop script for Music Player Daemon.

"/etc/init.d/mpd stop" works even when/if MPD is hanged/unresponsive.

Also allows MPD's niceness to be specified in /etc/conf.d/mpd.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2007-06-05 22:39:27 UTC
Well like, uh... wouldn't it make sense to fix the *real* bug that causes mpd to hang, instead of introducing such nasty hacks into the initscript?
Comment 3 Zrajm C Akfohg 2007-07-27 11:31:23 UTC
because

(a) I could fix this myself, immediately, without involvement of others.

(b) It will continue to work in the future, whether or not the bug in MPD gets fixed upstream.
Comment 4 John-John Tedro 2008-04-29 14:39:18 UTC
I had the same "hanging" problem with the initscript. The problem originated from two different scenarios:
a) mpd crashes (but manages to remove it's pidfile) in this case the initscript is 'stubborn' and you have to zap mpd to be able to start it again.
b) pidfile missing and mpd hangs (?), in this case, mpd --kill won't help you since pidfile is missing. I don't know why the file is missing (probably bad implementation within mpd).

The solution I used was to start mpd with start-stop-daemon and the option '--no-daemon' with mpd. In this case the initscript handles the pidfile and mercilessly kills mpd weither it hangs or not.
This also requires that you comment out the section with 'pid_file' in mpd.conf.

so this is what I do to start mpd:
start-stop-daemon --pidfile $MPD_PIDFILE --make-pidfile --background --start --exec /usr/bin/mpd -- --no-create-db --no-daemon

and to stop:
start-stop-daemon --stop --pidfile $MPD_PIDFILE --name mpd

hope it helps!
Comment 5 Christoph Mende (RETIRED) gentoo-dev 2009-01-19 00:39:58 UTC
I might change it to s-s-d as soon as there's a hanging problem with mpd-0.14 (seems like the usual stop always helped me here), definitely not gonna use Zrajm's init script, so closing here