How do you restart Rails under Mongrel, without stopping and starting Mongrel
Asked Answered
K

4

8

Is there a way to restart the Rails app (e.g. when you've changed a plugin/config file) while Mongrel is running. Or alternatively quickly restart Mongrel. Mongrel gives these hints that you can but how do you do it?

** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).

** Rails signals registered. HUP => reload (without restart). It might not work well.

Kc answered 16/9, 2008 at 16:25 Comment(0)
C
5

You can add the -c option if the config for your app's cluster is elsewhere:

mongrel_rails cluster::restart -c /path/to/config
Chinkapin answered 16/9, 2008 at 17:50 Comment(0)
R
5

1st discover the current mongrel pid path with something like:

>ps axf | fgrep mongrel

you will see a process line like:

ruby /usr/lib64/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/mongrel_rails start -p 3000 -a 0.0.0.0 -e development -P /home/xxyyzz/rails/myappname/tmp/pids/mongrel.pid -d

Take the '-P /home/xxyyzz/rails/myappname/tmp/pids/mongrel.pid' part and use it like this:

>mongrel_rails restart -P /home/xxyyzz/rails/myappname/tmp/pids/mongrel.pid

Sending USR2 to Mongrel at PID 18481...Done.

I use this to recover from the dreaded "Broken pipe" to MySQL problem.

Rexer answered 18/9, 2008 at 5:36 Comment(0)
T
4

in your rails home directory

mongrel_rails cluster::restart
Trillbee answered 16/9, 2008 at 17:47 Comment(0)
B
3

For example,

killall -USR2 mongrel_rails
Butcherbird answered 16/9, 2008 at 16:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.