On 9/16/06, HH <lists at lastonepicked.com> wrote:>
> Someone on the Rails list mentioned that they thought it was possible to
> get
> 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> start-up:
>
> 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?
Process.detach
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...
URL:
http://rubyforge.org/pipermail/mongrel-users/attachments/20060916/907aa08d/attachment.html