Opened 14 years ago

Closed 14 years ago

#24043 closed defect (wontfix)

mpd-0.15.8_0: "mpd.wrapper stop" does not work (no pid_file configured)

Reported by: greg-macports@… Owned by: milosh@…
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: Cc: rmsfisher@…
Port: mpd

Description

I've just installed mpd-0.15.8_0 and followed the instructions for getting launchd to manage it. But stopping the daemon does not work: i.e. running "sudo launchctl stop org.macports.mpd" has no discernible effect on the system state. mpd just keeps running.

Here's how things look with mpd running:

$ ps u -ax |  grep mpd                                    
greg     81805   1.3  0.1    75436    396 s006  S+    5:50PM   0:00.00 grep mpd
root       177   0.0  0.9    88532   6876 s000  S+    4:30PM   0:36.58 ./bin/mpd etc/mpd.conf --no-daemon --stdout
root     46337   0.0  0.1    75424    704   ??  Ss    5:37PM   0:00.01 /opt/local/bin/daemondo --label=mpd --start-cmd /opt/local/etc/LaunchDaemons/org.macports.mpd/mpd.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.mpd/mpd.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.mpd/mpd.wrapper restart ; --pid=none

(Disclaimer: I am completely new to MacPorts and launchd. So I'm making educated guesses here.)

From this, I'm guessing that "sudo launchctl stop org.macports.mpd" runs

/opt/local/etc/LaunchDaemons/org.macports.mpd/mpd.wrapper stop

But if I run that command manually, it fails:

$ sudo etc/LaunchDaemons/org.macports.mpd/mpd.wrapper stop
daemon: no pid_file specified in the config file
etc/LaunchDaemons/org.macports.mpd/mpd.wrapper: line 23: 92889 Abort trap              /opt/local/bin/mpd --kill

(Incidentally, it takes a loooong time for mpd to crash, around 21 sec. Not sure if that is an upstream bug or not.)

From the reading I've done on launchd, I gather that pid files are frowned upon: you're supposed to launchd take care of it. OK, fine, but doesn't that mean that mpd.wrapper cannot use "mpd --kill"?

Change History (7)

comment:1 Changed 14 years ago by greg-macports@…

Oops, again forgot to mention that this is on OS X 10.5.8 on a G4.

comment:2 Changed 14 years ago by mf2k (Frank Schima)

Cc: rmsfisher@… added
Owner: changed from macports-tickets@… to milosh@…

comment:3 Changed 14 years ago by rmsfisher@…

I don't want to say outright, "You're doing it wrong," as I'm sure there exist alternatives to the "normal way" to load and unload launchd plists.
Please try:
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mpd.plist
Let us know if that works for you.

comment:4 Changed 14 years ago by rmsfisher@…

Greg,
Please let me know if the above command for unloading this launchd plist works for you. If I don't hear from you within a week, I will assume you worked it out and close this ticket as "wontfix".

Cheers,
Ryan

comment:5 Changed 14 years ago by xcingix@…

Error in connection() 61 - Connection refused ool-4354fe61:bin danny$ sudo port mpd restart Unrecognized action "mpd" ool-4354fe61:bin danny$ sudo mpd restart config: problems opening file restart for reading: No such file or directory Abort trap ool-4354fe61:bin danny$ sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mpd.plist launchctl: Error unloading: org.macports.mpd ool-4354fe61:bin danny$

comment:6 in reply to:  4 Changed 14 years ago by greg-macports@…

Replying to rmsfisher@…:

Please let me know if the above command for unloading this launchd plist works for you. If I don't hear from you within a week, I will assume you worked it out and close this ticket as "wontfix".

Huh? Sorry, you stop a daemon by unloading a config file? That's just weird. But if that's how launchd works, I guess that's how it works. Whatever.

So yeah, you can mark this one "won't fix" or "not a bug" or "problem between keyboard and chair", whatever. ;-)

comment:7 Changed 14 years ago by rmsfisher@…

Resolution: wontfix
Status: newclosed

It's really wacky, especially when files left loaded (with 'launchctl load -w') are modified or removed leaving their tasks in limbo. If you need any additional help with launchd .plist files, #macports on Freenode IRC has several users who understand it better than I do.

Note: See TracTickets for help on using tickets.