Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 260213 - media-sound/mpd: init script to stop mpd will fail if mpd is not running.
Summary: media-sound/mpd: init script to stop mpd will fail if mpd is not running.
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 08:51 UTC by Nik Nyby
Modified: 2009-02-27 19:49 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nik Nyby 2009-02-25 08:51:04 UTC
If you run mpd --kill (or if mpd crashes on its own) after starting mpd with the init script, you won't be able to start mpd again using the init script.

Here's an example of what happens:

# /etc/init.d/mpd stop 
 * Stopping Music Player Daemon ...
daemon: unable to open pid file "/var/run/mpd/mpd.pid": No such file or directory
/etc/init.d/mpd: line 27:  3359 Aborted                 /usr/bin/mpd --kill /etc/mpd.conf

# /etc/init.d/mpd start
 * WARNING:  mpd has already been started.

Reproducible: Always

Steps to Reproduce:
1. # /etc/init.d/mpd start
2. # mpd --kill
3. # /etc/init.d/mpd stop  (or restart)

Actual Results:  
mpd can no longer be started with the init script.

Expected Results:  
/etc/init.d/mpd stop should succeed if mpd isn't running.

here's a fix:

here's a fix:

29c29,33
< 	/usr/bin/mpd --kill /etc/mpd.conf
---
> 	if pgrep -x mpd >/dev/null; then
> 		/usr/bin/mpd --kill /etc/mpd.conf
> 	else
> 		ewarn "No mpd process to stop"
> 	fi
Comment 1 Marvin Vek 2009-02-25 21:24:14 UTC
# /etc/init.d/mpd start
# mpd --kill
# /etc/init.d/mpd stop
 * Stopping Music Player Daemon ...
unable to open pid_file "/var/run/mpd/mpd.pid": No such file or director  [ !! ]


Now, this is what they made zap for, right?

# /etc/init.d/mpd zap
 * Manually resetting mpd to stopped state.
# /etc/init.d/mpd stop
 * WARNING:  mpd has not yet been started.
# /etc/init.d/mpd start
 * Starting Music Player Daemon ...                                       [ ok ]

Besides, i don't see the reason for using an mpd --kill if we have /etc/init.d/mpd stop. Plus, if we'd use your fix the /etc/init.d/mpd start wouldn't work i guess so we still need zap.

I'd WONTFIX.
Comment 2 Nik Nyby 2009-02-27 19:49:44 UTC
(In reply to comment #1)
> Now, this is what they made zap for, right?

Oh, I didn't know about zap. My fault :-)