Easy Button for Mongrel

July 21st, 2006

If you’ve hopped on the Mongrel bandwagon, you know how convenient and efficient the Mongrel server can be for running Ruby on Rails applications.

The only thing that’s not so convenient about Mongrel is the way you start it when you’re working in development mode. Typing that long command (mongrel_rails start -d -p 3000 -e development) every time you want to start your web app can be a real pain.

So I came up with this quick shell script (UNIX/Linux only – sorry Windows folks) that does the same thing as the script/server command.

The script/mongrel file


#!/bin/sh
/usr/local/bin/mongrel_rails start \
 -d \
 -p 3000 \
 -e development \
 -c /path/to/your/web/app

To use it:

  1. Go to your Rails app and make a file in your script directory called mong