[Backgroundrb-devel] Fails to start via Capistrano?

andrew at workingtechnology.co.uk andrew at workingtechnology.co.uk
Sun Feb 8 05:56:12 EST 2009

Thanks guys,

I think it might be something to do with the capistrano login session.

If I use essentially the same code as Samer for my cap task:

desc "Start Backgroundrb"
task :start_backgroundrb, :roles => [:app] do
   run "#{deploy_to}/current/script/backgroundrb start -- 

I get the following output:

  cap restart_backgroundrb
   * executing `restart_backgroundrb'
   * executing "/var/webapps/optics/current/script/backgroundrb start  
     servers: [""]
     [] executing command
  ** [out ::] Starting BackgrounDRb ....
     command finished

This updates the pid file with 4488. However look up the pid and  

$ ps aux | grep 4488
deploy    4534  0.0  0.0   3924   680 pts/1    S+   10:30   0:00 grep  

If however I run the cap task's run command by hand on the server via  
a normal ssh session (same user, "deploy") the pid generated actually  
to a running process:

$script/backgroundrb start --environment=production

$ps aux | grep 5080
deploy    5080  0.6  1.6  57536 51088 pts/1    S    10:44   0:00 ruby  
script/backgroundrb start --environment=production
deploy    5089  0.0  0.0   3920   676 pts/1    S+   10:44   0:00 grep  

I guess there is something specific about the cap session that is  
different to a regular ssh. If I can't find a solution, as suggested I  
suppose I could use god/monit to restart the process locally and just  
use the cap task to stop the backgroundrb process, which it doesn't  
seem to have a problem with unlike starting.

Thanks for your help, Andrew.

On 7 Feb 2009, at 16:49, E. Johnson wrote:

> It looks like the restart of backgroundrb failed to start backgroundrb
> because restart's stop-backgroundrb failed (nothing running, nothing
> to stop), and quit the task.
> If that's the case, perhaps a start_backgroundrb task is in order? I'm
> controlling backgroundrb via god, and calling them from capistrano w/
> the following task set:
> $ cap -T |grep backgroundrb
> cap restart_backgroundrb       # restart backgroundrb servers
> cap start_backgroundrb         # start backgroundrb servers
> cap stop_backgroundrb          # stop backgroundrb servers
> # Backgroundrb Server TASKS
> %w(start stop restart).each do |cmd|
>  desc "#{cmd} backgroundrb servers"
>  task "#{cmd}_backgroundrb".to_sym, :roles => :app do
>    run "sudo #{god} #{cmd} backgroundrb"
>  end
> end
> hope that helps,
> Erik

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the Backgroundrb-devel mailing list