[Backgroundrb-devel] Unable to start with Capistrano...

Eden Li eden.li at gmail.com
Tue Sep 5 05:15:47 EDT 2006

Ah, it appears `nohup' is the answer.  You if you add nohup before the
backgroundrb script invocation in your capistrano recipe, everything
works perfect:

desc "Start backgroundrb"
task :backgroundrb_start, :roles => :app do
  run "RAILS_ENV=#{rails_env} nohup
#{current_path}/script/backgroundrb/start -d > /dev/null 2>&1"

Thanks for posting the script.  Maybe the next release of backgroundrb
could include capistrano recipes for starting/stopping/restarting the
same way mongrel_cluster does?

On 9/2/06, Jonathan Métillon <jmetillon at gmail.com> wrote:
> Maybe this is overkill but here is a bash script I've wrote to
> forcefully restart BackgrounDRb:
> #!/bin/sh
> if [ -a "log/backgroundrb.pid" ]; then
>   pid=`cat log/backgroundrb.pid`
>   if [[ -n "$pid" ]]; then
>     echo "Killing current BackgrounDRb server (pid: $pid)"
>     kill -9 $pid
>   fi
> fi
> echo "Starting the BackgrounDRb server"
> cd /var/www/123/current
> log="/tmp/backgroundrb.`date +%s`"
> echo "Writing to $log"
> nohup rake backgroundrb:start > $log 2>&1
> cat $log
> rm -f $log
> It is derived from a script I found while googling, I don't remember
> who it's from so I can't give credit.
> Here's what I added to my deploy recipe:
> task :before_restart, :roles => :app do
>   sudo "#{release_path}/script/backgroundrb/restart"
> end

More information about the Backgroundrb-devel mailing list