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.
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.
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?
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.
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!
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