Welcome Guest | Login

Quick noob question: how do I restart mongrel?

I've been making some edits to the layout rhtml files (adding google analytics tracking code), but the changes  aren't showing up right away.  I assume that a restart of mongrel is on order?  If so, how do I do that?

2008-05-24 02:15 PM

Hi Freeform,

You can restart the mongrel instance of your application by executing the command from your rails app folder.

$ mongrel_rails restart

If you are using mongrel cluster then you can use the command

$ mongrel_rails cluster::restart


2008-05-24 04:46 PM

when I run mongrel_rails restart I get the following:

!!! PID file log/mongrel.pid does not exist.  Not running?
mongrel::restart reported an error. Use mongrel_rails mongrel::restart -h to get help.

2008-05-24 05:39 PM

Hi Freeform,

Please execute the command from your home directory and verify the status of mongrel set up for your application.

$ ps  

If mongrel is not running then please start the mongrel instance using the command from your rails app folder.

$ mongrel_rails start -e production -p <port> -d  

The following wiki link will guide you to understand more about
setting up of a mongrel instance for rails application.
http://www.hostingrails.com/forums/wiki_thread/19.

2008-05-24 06:44 PM

Mongrel seems to be running.  ps returns the following:

/usr/local/bin/ruby /usr/local/bin/mongrel_rails start -e production -p 4543 -d

2008-05-24 11:53 PM

So, any idea why mongrels can't be restarted even though its running fine?

2008-05-26 07:50 AM

Hi - Sure you can restart the running mongrel using the command

/usr/local/bin/mongrel_rails restart

from the rails root directory.

2008-05-26 07:54 AM

HostingRails Support
By rails root directory, which directory do you mean?

2008-05-26 11:52 AM

Hi - Your ruby application directory . Thank you

2008-05-26 11:57 AM

HostingRails Support
Nope, it still isn't working by running it in my ruby app's directory:

!!! PID file log/mongrel.pid does not exist.  Not running?
mongrel::restart reported an error. Use mongrel_rails mongrel::restart -h to get help.


I run ps and get the following:
freefor  21722  0.0  0.9  45648 39484 ?        S    May08   0:07 /usr/local/bin/ruby /usr/local/bin/mongrel_rails start -e production -p 4543 -d

2008-05-26 09:16 PM

This issue is because the 'mongrel.pid' file is missing inside the log directory. This file actually contains the PID of the mongrel process. I.E in this case 21722

Since this file is missing the mongrel cannot restart as it cannot find the old mongrel process PID.

So in this cases you will need to kill the mongrel PID manually.
Run the command 'kill -9 <Mongrel PID>'

In this case it is 'kill -9 21722' . then you will need to start the mongrel process again.



2008-05-26 09:53 PM

Regards,
Rahul
Super, that seemed to do the trick, thanks!

2008-05-27 09:03 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.