# Trouble launching my RoR server on startup

**URL:** <https://www.ruby-forum.com/t/trouble-launching-my-ror-server-on-startup/128703>\
**Category:** Rails\
**Created:** [February 10, 2008, 7:26pm UTC](https://www.ruby-forum.com/t/trouble-launching-my-ror-server-on-startup/128703 "2008-02-10T19:26:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 10, 2008, 7:26pm UTC](https://www.ruby-forum.com/t/trouble-launching-my-ror-server-on-startup/128703/1 "2008-02-10T19:26:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 11, 2008, 1:11am UTC](https://www.ruby-forum.com/t/trouble-launching-my-ror-server-on-startup/128703/2 "2008-02-11T01:11:47Z")

</div>

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/](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

On Feb 10, 6:25 pm, “removed\_email\_address@domain.invalid”

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 11, 2008, 4:43pm UTC](https://www.ruby-forum.com/t/trouble-launching-my-ror-server-on-startup/128703/3 "2008-02-11T16:43:29Z")

</div>

On Sun, 10 Feb 2008, removed\_email\_address@domain.invalid wrote:

> 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

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