Cannot run command 'script/spin': premission denied

Hi guys, I’m trying to deploy my application but when I run cap
deploy:cold I get the following error:

—ERROR--------------

servers: ["www.app.com"]
[www.app.com] executing command

** [out :: www.app.com] nohup:
** [out :: www.app.com] appending output to nohup.out' ** [out :: www.app.com] ** [out :: www.app.com] nohup: ** [out :: www.app.com] cannot run commandscript/spin’
** [out :: www.app.com] : Permission denied
** [out :: www.app.com]
command finished
command “sh -c ‘cd /home/app/current && nohup script/spin’” failed on
www.app.com

—SCRIPT/SPIN--------

/home/app/current/script/process/spawner -p 8000 -i 3

Anyone have any ideas?

Make sure script/spin has the correct permissions on it (at least
readable and executable) for the user that is being used to execute
it.

  • Jamis

Jamis B. wrote:

Make sure script/spin has the correct permissions on it (at least
readable and executable) for the user that is being used to execute
it.

  • Jamis

Hi Jamis,

How could I do this with capistrano?

Many people are doing this with a task that gets called after the code
is pushed out, something like this:

after “deploy:update_code”, :fix_script_perms

task :fix_script_perms do
run “chmod 755 #{latest_release}/script/spin”
end

Alternatively, if you’re using subversion, you can set the
svn:executable property on script/spin and be done with it.

  • Jamis

Jamis B. wrote:

Many people are doing this with a task that gets called after the code
is pushed out, something like this:

after “deploy:update_code”, :fix_script_perms

task :fix_script_perms do
run “chmod 755 #{latest_release}/script/spin”
end

Alternatively, if you’re using subversion, you can set the
svn:executable property on script/spin and be done with it.

  • Jamis

Thanks Jamis.

Is there a way to change the path of ruby in the dispatch files using
capistrano? As I need to change #!D:/ruby/bin/ruby to #!/usr/bin/ruby

I’m sure you could use some sed or awk magic to do it, but neither of
those tools are my forte, so I’ll defer to someone with more
experience to give you a more detailed answer.

  • Jamis

I’m having problems with the chmod command. I get the following error:

—ERROR------------------

D:\fapbox.com>cap deploy
[DEPRECATION] Capistrano.configuration is deprecated. Use
Capistrano::Configurat
ion.instance instead

  • executing `deploy’
  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
  • executing “svn checkout -q -r35 http://www.fapbox.com/svn/fapbox
    /home/fapb
    ox/releases/20070907194029 && (echo 35 >
    /home/fapbox/releases/20070907194029/RE
    VISION)”
    servers: [“www.fapbox.com”]
    Password:
    [www.fapbox.com] executing command
    command finished
  • executing `deploy:finalize_update’
  • executing “chmod -R g+w /home/fapbox/releases/20070907194029”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
  • executing “rm -rf /home/fapbox/releases/20070907194029/log
    /home/fapbox/rele
    ases/20070907194029/public/system
    /home/fapbox/releases/20070907194029/tmp/pids
    &&\n mkdir -p /home/fapbox/releases/20070907194029/public &&\n
    mkdir -
    p /home/fapbox/releases/20070907194029/tmp &&\n ln -s
    /home/fapbox/shared/l
    og /home/fapbox/releases/20070907194029/log &&\n ln -s
    /home/fapbox/shared/
    system /home/fapbox/releases/20070907194029/public/system &&\n ln
    -s /home/
    fapbox/shared/pids /home/fapbox/releases/20070907194029/tmp/pids”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
  • executing “find /home/fapbox/releases/20070907194029/public/images
    /home/fap
    box/releases/20070907194029/public/stylesheets
    /home/fapbox/releases/20070907194
    029/public/javascripts -exec touch -t 200709071940.47 {} ‘;’; true”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
    triggering after callbacks for `deploy:update_code’
  • executing `fix_script_perms’
  • executing “chmod 755
    /home/fapbox/releases/20070907194029/script/spin”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    ** [out :: www.fapbox.com] chmod: cannot access
    `/home/fapbox/releases/20070907
    194029/script/spin’: No such file or directory
    command finished
    *** [deploy:update_code] rolling back
  • executing “rm -rf /home/fapbox/releases/20070907194029; true”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
    command “chmod 755 /home/fapbox/releases/20070907194029/script/spin”
    failed on w
    ww.fapbox.com

This is my deploy.rb

—DEPLOY.RB----------------------

require ‘mongrel_cluster/recipes’

set :application, “fapbox”
set :repository, “http://www.fapbox.com/svn/#{application}
set :deploy_to, “/home/#{application}”
set :runner, “root”
set :user, “root”
set :svn_username, “root”
set :svn_password, “ketimella9”
set :checkout, “export”
set :use_sudo, false
set :mongrel_conf, “#{current_path}/config/mongrel_cluster.yml”

role :app, “www.#{application}.com”
role :web, “www.#{application}.com”
role :db, “www.#{application}.com”, :primary => true

after “deploy:update_code”, :fix_script_perms
task :fix_script_perms do
run “chmod 755 #{latest_release}/script/spin”
end

Why don’t you add this to your deploy.rb file instead of using spinner
script?

set :mongrel_conf,
“/var/www/#{application}/current/config/mongrel_cluster.yml”

namespace :deploy do
namespace :mongrel do
[ :stop, :start, :restart ].each do |t|
desc “#{t.to_s.capitalize} the mongrel appserver”
task t, :roles => :app do
#invoke_command checks the use_sudo variable to determine how to
run th$
invoke_command “mongrel_rails cluster::#{t.to_s} -C
#{mongrel_conf}”, :blush:
end
end
end

desc “Custom restart task for mongrel cluster”
task :restart, :roles => :app, :except => { :no_release => true } do
deploy.mongrel.restart
end

desc “Custom start task for mongrel cluster”
task :start, :roles => :app do
deploy.mongrel.start
end

desc “Custom stop task for mongrel cluster”
task :stop, :roles => :app do
deploy.mongrel.stop
end
end

It works great for me … I haven’t tried achieving the same with your
approach because “I didn’t get it” when reading about it for the first
time… This works, because it overrides the default tasks for restarting
mongrel. So it works with “cap deploy” and of course with “cap
deploy:mongrel:start” etc.

Maybe I’m wrong… would be grateful if someone commented on the
differences between spinner script and this.

bye!
david

Jim N. wrote:

I’m having problems with the chmod command. I get the following error:

—ERROR------------------

D:\fapbox.com>cap deploy
[DEPRECATION] Capistrano.configuration is deprecated. Use
Capistrano::Configurat
ion.instance instead

  • executing `deploy’
  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
  • executing “svn checkout -q -r35 http://www.fapbox.com/svn/fapbox
    /home/fapb
    ox/releases/20070907194029 && (echo 35 >
    /home/fapbox/releases/20070907194029/RE
    VISION)”
    servers: [“www.fapbox.com”]
    Password:
    [www.fapbox.com] executing command
    command finished
  • executing `deploy:finalize_update’
  • executing “chmod -R g+w /home/fapbox/releases/20070907194029”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
  • executing “rm -rf /home/fapbox/releases/20070907194029/log
    /home/fapbox/rele
    ases/20070907194029/public/system
    /home/fapbox/releases/20070907194029/tmp/pids
    &&\n mkdir -p /home/fapbox/releases/20070907194029/public &&\n
    mkdir -
    p /home/fapbox/releases/20070907194029/tmp &&\n ln -s
    /home/fapbox/shared/l
    og /home/fapbox/releases/20070907194029/log &&\n ln -s
    /home/fapbox/shared/
    system /home/fapbox/releases/20070907194029/public/system &&\n ln
    -s /home/
    fapbox/shared/pids /home/fapbox/releases/20070907194029/tmp/pids”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
  • executing “find /home/fapbox/releases/20070907194029/public/images
    /home/fap
    box/releases/20070907194029/public/stylesheets
    /home/fapbox/releases/20070907194
    029/public/javascripts -exec touch -t 200709071940.47 {} ‘;’; true”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
    triggering after callbacks for `deploy:update_code’
  • executing `fix_script_perms’
  • executing “chmod 755
    /home/fapbox/releases/20070907194029/script/spin”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    ** [out :: www.fapbox.com] chmod: cannot access
    `/home/fapbox/releases/20070907
    194029/script/spin’: No such file or directory
    command finished
    *** [deploy:update_code] rolling back
  • executing “rm -rf /home/fapbox/releases/20070907194029; true”
    servers: [“www.fapbox.com”]
    [www.fapbox.com] executing command
    command finished
    command “chmod 755 /home/fapbox/releases/20070907194029/script/spin”
    failed on w
    ww.fapbox.com

This is my deploy.rb

—DEPLOY.RB----------------------

require ‘mongrel_cluster/recipes’

set :application, “fapbox”
set :repository, “http://www.fapbox.com/svn/#{application}
set :deploy_to, “/home/#{application}”
set :runner, “root”
set :user, “root”
set :svn_username, “root”
set :svn_password, “ketimella9”
set :checkout, “export”
set :use_sudo, false
set :mongrel_conf, “#{current_path}/config/mongrel_cluster.yml”

role :app, “www.#{application}.com”
role :web, “www.#{application}.com”
role :db, “www.#{application}.com”, :primary => true

after “deploy:update_code”, :fix_script_perms
task :fix_script_perms do
run “chmod 755 #{latest_release}/script/spin”
end

I’m sorry, some lines got screwed up, because they were too long… here
it goes again:

set :mongrel_conf,
“/var/www/#{application}/current/config/mongrel_cluster.yml”

namespace :deploy do
namespace :mongrel do
[ :stop, :start, :restart ].each do |t|
desc “#{t.to_s.capitalize} the mongrel appserver”
task t, :roles => :app do
#invoke_command checks the use_sudo variable to determine how to
run the mongrel_rails command
invoke_command “mongrel_rails cluster::#{t.to_s} -C
#{mongrel_conf}”, :via => run_method
end
end
end

desc “Custom restart task for mongrel cluster”
task :restart, :roles => :app, :except => { :no_release => true } do
deploy.mongrel.restart
end

desc “Custom start task for mongrel cluster”
task :start, :roles => :app do
deploy.mongrel.start
end

desc “Custom stop task for mongrel cluster”
task :stop, :roles => :app do
deploy.mongrel.stop
end

end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs