Trouble launching my RoR server on startup

Hi,

I created this script to launch my RoR server

==============begin script======================== #!/bin/bash

. /etc/rc.d/init.d/functions

RETVAL=$? EASYRXHOME="/usr/local/apache2/htdocs/easyrx"

case "$1" in start)         cd $EASYRXHOME/         ruby script/server         ;; stop)         kill -9 `ps aux | grep 'script/server' | awk '{print $2}'`         ;; *)         echo $"Usage: $0 {start|stop}"         exit 1         ;; esac

exit $RETVAL ==============end script=========================

But when I try and run the script (when logged in as root), I get this error,

[root@me dir]# cd /etc/init.d [root@me init.d]# ./easyrxd start ./script/../config/boot.rb:9:in `require': no such file to load -- rubygems (LoadError)         from ./script/../config/boot.rb:9         from script/server:2:in `require'         from script/server:2

Does anyone know what this error means? If I manually type in the start command, RoR starts fine.

Thanks, - Dave

Hi, Not a massive expert on bash, but i have deployed a good number of rails applications now and I would recommend you get hold of mongrel / mongrel_cluster gems and run a set of proxy server instances which apache just forwards the requests to. You'll need Apache 2.2.x with mod_proxy_balancer, or better, use nginx which is a lot lighter. There are heaps of tutorials out there for setting up mongrel_cluster. The first one i used was http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/

It's a bit daunting at first, but it is worth it.The rails community generally recommend this configuration. Mongrel cluster comes with the init scripts you need for startup and management, and it prevents thread-locking problems that occur serving lots of page requests due to rails' single-threaded nature.

Best, Joe

Err, how about looking at line 2 in boot.rb as it shows above?