Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

launchctl conformance? #370

Closed
oojacoboo opened this Issue · 12 comments

3 participants

@oojacoboo

I'm trying to use...

launchctl stop php-fpm (I renamed the label to something sane)

however, there seems to be issues. I suspect it has something to do with how it's all invoked and going against the expectations of launchd.

How can we start/stop/restart php-fpm?

@phoenixsong6

Usage of launchctl stop is generally discouraged according to the launchctl manpage.

Likely the reason it isn't stopping the process is because our php-fpm.plist specifies that the process should be kept alive. It restarts itself right after you stop it.

You could set KeepAlive to false and then control it using your invocation above though.

@oojacoboo

yea, I tried that first thing, that doesn't fix it. Infact, I tried a ton of things, I can't get it to work at all. I think it has something to do with how it spawns new processes, etc.

@phoenixsong6

You might be right. Processes that use daemon or emulate it are not to be used with launchd. I haven't looked into it, but I suspect this might be the cause.

If we change the php-fpm.conf file and set daemonize = no, it might do the trick.

The other option is that PHP includes a init.d script for FPM. This request has been around for a while, and I was supposed to take care of it quite some time ago. It is trivial to implement (just copy the file from sapi/fpm/init.d.php-fpm to the destination), but I wasn't sure if it was appropriate (OS X design doesn't really lend itself to such scripts).

If people have an idea of where they want it (I'd assume /usr/local/sbin) and what to call it (php-fpm is taken, though I suppose we could use fpm), it'd only take a single line to implement.

sbin.install 'sapi/fpm/init.d.php-fpm' => 'fpm'

I personally don't feel that an init.d script is appropriate for this situation, so give the daemonize option a try.

@josegonzalez

We'd likely use something like php53-fpm or php54-fpm for the init.d script -which I am +1 on.

Ideally we remove the daemonize option and let launchd handle keeping the process up and running. What changes should we do to make this possible?

@oojacoboo

Oh, along the same lines, check this out... the plist fix here fixes the binding issue, which I was certainly getting every couple seconds in the logs...

http://serverfault.com/questions/432451/apache-fcgi-php-fpm-mac-os-x-10-8-unable-to-bind

@josegonzalez

A pull request would be nice...

@phoenixsong6 phoenixsong6 referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@phoenixsong6 phoenixsong6 referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@phoenixsong6

I didn't realize that LaunchOnlyOnce wasn't a part of the original plist. Mine has always had it... must have added it sometime in the past.

Take a look at the plist branch on my fork. If it looks good I'll push it to master.

@josegonzalez

Seems legit. Please merge at your earliest convenience.

@phoenixsong6

Sorry. Had to take care of finals first. Will merge tonight.

@josegonzalez

Sup

@phoenixsong6 phoenixsong6 referenced this issue from a commit in phoenixsong6/homebrew-php
@phoenixsong6 phoenixsong6 launchd - Launch FPM only once (see #370) c32fffa
@phoenixsong6 phoenixsong6 referenced this issue from a commit in phoenixsong6/homebrew-php
@phoenixsong6 phoenixsong6 FPM: Include control script (see #370) 22c3465
@phoenixsong6

Done with 22c3465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.