[Mongrel] log and pid file problems when using a config file w/ -C

Mark Cornick mcornick at mcornick.org
Tue Jun 13 17:46:50 EDT 2006

Hi there,

I'm using Mongrel (0.3.13 prerelease, installed today) to serve up some
Rails apps in production. Everything works fine if I give all the
appropriate options on the command line, such as:

$ mongrel_rails start -c /home/mcornick/rails/mcornick.org/current -P log/mongrel.pid -l log/mongrel.log -e production -d -a -p 6833

So, having accomplished that, I thought it would be easier to dump all
that stuff into a config file to use with the -C option. So I did this:

$ mongrel_rails start -c /home/mcornick/rails/mcornick.org/current -P log/mongrel.pid -l log/mongrel.log -e production -d -a -p 6833 -G config/mongrel.yml

Which also worked, and generated a YAML file with my options:

:cwd: /home/mcornick/rails/mcornick.org/current
- mongrel
:environment: production
:timeout: 0
:log_file: log/mongrel.log
#:pid_file: log/mongrel.pid
:num_processors: 1024
:debug: false
:docroot: public
:port: "6833"
:daemon: true

And it almost works. If I then try:

$ mongrel_rails start -C /home/mcornick/rails/mcornick.org/current/config/mongrel.yml
** You have sendfile installed, will use that to serve files.
!!! Path to log file not valid: log/mongrel.log
start reported an error. Use mongrel_rails start -h to get help.

Which makes me think the cwd option isn't being picked up. OK, no biggie,
I change directories to /home/mcornick/rails/mcornick.org/current and:

$ mongrel_rails start -C config/mongrel.yml
** You have sendfile installed, will use that to serve files.
** Loading settings from config/mongrel.yml (command line options override).
** Starting Mongrel in production mode at
** Daemonizing, any open files are closed.  Look at log/mongrel.pid and log/mongrel.log for info.  

Looks good, mongrel is running, except that the log/mongrel.pid file is not
created (although the log/mongrel.log file is.) So I can't later do
mongrel_rails stop, or easily restart from my Capistrano recipe, etc.

Do I have the config file syntax right? (I didn't change any of the keys
from the -G output.) Is there something else I should be doing here?

BTW, I am running with Ruby 1.8.4 on FreeBSD 6.1-RELEASE. I have the
sendfile gem installed, as well as mongrel_cluster which I haven't done
anything with yet, in addition to the standard set of Rails 1.1.2 gems.


More information about the Mongrel-users mailing list