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

Jonathan Métillon jmetillon at gmail.com
Fri Sep 1 12:33:48 EDT 2006


On 9/1/06, Ezra Zygmuntowicz <ezmobius at gmail.com> wrote:
>
> Here are my tasks for stopping, starting and restarting.
>
>    desc <<-DESC
>    Stop the backgroundrb server
>    DESC
>    task :stop_backgroundrb , :roles => :drb do
>      run "#{current_path}/script/backgroundrb/stop"
>    end
>
>    desc <<-DESC
>    Start the backgroundrb server
>    DESC
>    task :start_backgroundrb , :roles => :drb do
>      run "#{current_path}/script/backgroundrb/start -d"
>    end
>
>    desc <<-DESC
>    Start the backgroundrb server
>    DESC
>    task :restart_backgroundrb , :roles => :app do
>      stop_backgroundrb
>      start_backgroundrb
>    end
>
>
> Cheers-
> -Ezra

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