More elegant Mongrel restarts

By Common Media November 15, 2007

Having explained our hack for bringing back Mongrel after a server crash, I discovered that our hosting company has a different approach. Their method has the advantage of not requiring scripts with hard-coded paths; on the other hand, it does require you to patch Mongrel itself, which makes things interesting come upgrade time. (On the other hand, the hypothetical Mongrel update may incorporate this patch, or avoid the problem some other way.)

Their method patches Mongrel to test whether the processes enumerated in the PID file(s) are actually still running. If the process is dead (that is, the PID file belongs to a Mongrel instance which died in a server crash,) the file is declared “stale” and cleared, allowing Mongrel to start up properly; if the process exists, the PID file is not stale, and Mongrel aborts startup as it was originally designed.

The method is detailed here (scroll down to the heading, “Stale PID files preventing Mongrel to start up,” ungrammatical though it may be.)

Let’s collaborate!

Whether you need a technical partner to expand internal resources or a "one stop shop" that can handle your most complex and critical digital projects, we would love the opportunity to elevate your digital presence.