David Masover
2/19/2009 6:00:00 AM
Petr Janda wrote:
> What I need to do
> is start the app, get its PID(to store it in a databasse), and move it
> to the background so the rails application doesnt hang.
>
I think the other posts are right... If it's not part of your app, by
the way, you could do:
pid = fork { exec('ezstream') }
Assuming 'ezstream' is the command you'd have to run.
> Any ideas?
Well, since you asked...
This problem has been solved over and over again in Rails. Look up
workling/starling, nanite (or whatever it's called now), backgroundrb,
drb, monit, god, etc, ad nauseum.
I'm not saying that there's no possibility of doing it better -- I know
I had a similar problem recently that I solved with an old-fashioned
daemon and polling. Just probably worth looking at what's already out
there before you reinvent the wheel.