[Mongrel] Running Shell Scripts/Commands at Startup?
gethemant at gmail.com
Fri Sep 15 15:00:32 EDT 2006
On 9/16/06, HH <lists at lastonepicked.com> wrote:
> Someone on the Rails list mentioned that they thought it was possible to
> Mongrel to launch other processes at start time.
> I have an app that relies on backgroundrb and also an external listening
> program and I'd love it if I could set it up so that when Mongrel starts,
> these start as well.
> Is it true that this can be done?
> Where would I look for documentation on this?
> I thought perhaps the -S option might help but it looks like that's for
> something else.
I think that "someone" was me. According to Zed :
You could put it in a mongrel.conf and just have Mongrel run it on
> mongrel_rails start -S mongrel.conf
> (Even though it ends in .conf it's actually Ruby code that gets run
> inside the Configurator.)
I am not entirely sure, what Zed meant by inside Configurator, but you can
always write a ruby program, which will fork the process and detach itself
from the current process using Process.detach.
So, technically this script should work:
exec("rake backgroundrb:start") if fork.nil?
Of course...i haven't tested it and you need to set some environment
stuff...before you can have access to proper rake command.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mongrel-users