Forum: Ruby on Rails Capistrano won't spawn fcgi processes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
10c741d575988433e3fcd04133f3c462?d=identicon&s=25 Sebastian Friedrich (Guest)
on 2006-05-23 08:54
(Received via mailing list)
I've ran into quiet an annoying problem: I have a Capistrano task
that is supposed to run a shell script. The script restarts a rails
application by first killing all active fcgi processes and then
spawning new ones again. The shell script works fine when executed
locally on the server but running this in a Capistrano task will
simply not work.

The task is simple:

desc "ReStart Rails"
task :rails_app_restart, :roles => :app do
   run "#{home_directory}/etc/rc.d/restart_rails.sh"
end

my restart_rails.sh:

if [ -e home_dir/var/run/app-0.pid ]; then kill -9 `cat home_dir/var/
run/app-0.pid`; echo 'Killed home_dir/var/run/app-0.pid'; fi
if [ -e home_dir/var/run/app-0.pid ]; then rm -f home_dir/var/run/
app-0.pid; echo 'Force deleted home_dir/var/run/app-0.pid'; fi
if [ ! -e home_dir/var/run/app-0.pid ]; then RAILS_ENV=production /
usr/local/bin/spawn-fcgi -f base_path/current/public/dispatch.fcgi -s
home_dir/var/run/app-0.socket -P home_dir/var/run/app-0.pid; else
echo 'home_dir/var/run/app-0.pid already exists.'; fi
if [ -e home_dir/var/run/app-1.pid ]; then kill -9 `cat home_dir/var/
run/app-1.pid`; echo 'Killed home_dir/var/run/app-1.pid'; fi
if [ -e home_dir/var/run/app-1.pid ]; then rm -f home_dir/var/run/
app-1.pid; echo 'Force deleted home_dir/var/run/app-1.pid'; fi
if [ ! -e home_dir/var/run/app-1.pid ]; then RAILS_ENV=production /
usr/local/bin/spawn-fcgi -f base_path/current/public/dispatch.fcgi -s
home_dir/var/run/app-1.socket -P home_dir/var/run/app-1.pid; else
echo 'home_dir/var/run/app-1.pid already exists.'; fi

Again, no problem running this script directly. But when Capistrano
runs it, no processes are created even though the command output
indicates that everything was executed correctly. In fact, the socket
and pid files are created just fine by the cap task. The two fcgi
processes, however, never start. There're no errors indicating any
kind of trouble.

I just can't think of a single reason why this would start up fine
when running the script from the command line but not when executed
remotely via capistrano (and despite the good command output).
Anybody has an ideas where the problem could be? Thank you very much.

Sebastian
E28c35323f624b8b9ed8712e25105454?d=identicon&s=25 Ray Baxter (Guest)
on 2006-05-23 13:00
(Received via mailing list)
Sebastian Friedrich wrote:
> I've ran into quiet an annoying problem: I have a Capistrano task that
> is supposed to run a shell script. The script restarts a rails
> application by first killing all active fcgi processes and then spawning
> new ones again. The shell script works fine when executed locally on the
> server but running this in a Capistrano task will simply not work.

Here's one answer: http://tinyurl.com/jx4bk

--

Ray
10c741d575988433e3fcd04133f3c462?d=identicon&s=25 Sebastian Friedrich (Guest)
on 2006-05-23 20:47
(Received via mailing list)
thanks. unfortunately the answer didn't yet solve the problem. the
problem seems to have nothing to do with the script itself but with
the way capistrano executes it. If anybody has any idea, please have
a look at the ongoing discussion on technoweenie: http://tinyurl.com/
jx4bk Thanks and sorry for the x-posting.

Sebastian
This topic is locked and can not be replied to.