zedshaw/mongrel2 — Issue #117: m2sh does not play well with process supervisors.
Author: larsks
Created: 2012-03-09 02:13:23+00:00
State: open

Starting mongrel2 via `m2sh` as a non-root user runs mongrel2 in the foreground...which is exactly what I want! I'm using [supervisor][1] as a processor manager, and it (and I've read the mongrel2 manual so I know how you feel about this) expects processes to run in the foreground so that it can `wait()` on them to know when they exit.

I'm starting mongrel2 using `m2sh start ...`. The problem I've run into is that if I try to stop mongrel2 via `supervisor`, it sends a `SIGTERM` to `m2sh` -- which exits, leaving `mongrel2` still running (and now re-parented to `init`). I can (and I am) running `mongrel2` directly, but this means I have to refer to my server by UUID instead of by name or other more human-consumable label.

Either of the following seems like it would be reasonable:

- Have the `start` command `exec()` (optionally? like with a `-exec` flag?) mongrel2 so that the mongrel2 process replaces `m2sh`.
- Have `m2sh` trap `SIGTERM` and pass it on to the child process.

I'm curious what your thoughts are on either of these solutions.