[Backgroundrb-devel] Starting backgroundrb from rails and restarting with rails

Charles Brian Quinn me at seebq.com
Mon Jul 31 19:03:24 EDT 2006

While I'm not addressing all your issues -- we start backgroundrb
using a rake task and leave it running, so we start it up with our
rails app, see my previous message to the list.  To start under a
user, can't you just chown apache:apache the script/backgroundrb file

If you're capistranoing, I'd put in the after update code or after
deploy a task to start it, something like this:

desc "Tasks to run after a deploy"
task :after_deploy do
  run("cd #{current_path} && rake backgroundrb:stop")
  run("cd #{current_path} && rake backgroundrb:start")

And if you anticpate contention problems (i.e. it starting before it's
done stopping), you could put it in a script file with a sleep 5
command in b/t to make sure stop stops it....

p.s. Ezra, maybe we can add backgroundrb:restart and status tasks?

hope that helps

On 7/31/06, Jason Edgecombe <jedgecombe at carolina.rr.com> wrote:
> Hi,
> I have my rails sites tricked out with capistrano, and backgroundrb, so
> I can easily use the ant tasks, but I would like to be able to start and
> stop backgroundrb from within rails.
> I have a few reasons for this:
> 1. Using fastcgi, backgroundrb would start under the apache user and the
> same mod_security context as apache, instead of my developer account
> which has many more privileges.
> 2. I'd like rails to be able to start backgroundrb if it isn't running.
> 3. I'd also like rails to be to restart backgroundrb if rails itself has
> been restarted.
> 4. I'm lazy. ;)
> I'm thinking of having rails store the time that rails started in
> backgroundrb and restart backgroundrb if the time if the rails time is
> later than the backgroundrb time.
> Any pointers?
> Thanks,
> Jason Edgecombe
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel

Charles Brian Quinn

More information about the Backgroundrb-devel mailing list