# Cannot run command 'script/spin': premission denied

**URL:** <https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073>\
**Category:** Deployment\
**Created:** [September 7, 2007, 4:49pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073 "2007-09-07T16:49:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 7, 2007, 4:49pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/1 "2007-09-07T16:49:36Z")

</div>

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](http://www.app.com)] nohup:  
\*\* [out :: [www.app.com](http://www.app.com)] appending output to `nohup.out' **[out :: www.app.com]** [out :: www.app.com] nohup: ** [out :: www.app.com] cannot run command `script/spin’  
\*\* [out :: [www.app.com](http://www.app.com)] : Permission denied  
\*\* [out :: [www.app.com](http://www.app.com)]  
command finished  
command “sh -c ‘cd /home/app/current && nohup script/spin’” failed on  
[www.app.com](http://www.app.com)

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

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

Anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 7, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/2 "2007-09-07T17:05:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 7, 2007, 5:28pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/3 "2007-09-07T17:28:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 7, 2007, 5:33pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/4 "2007-09-07T17:33:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 7, 2007, 6:38pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/5 "2007-09-07T18:38:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 7, 2007, 6:55pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/6 "2007-09-07T18:55:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 7, 2007, 9:44pm UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/7 "2007-09-07T21:44:34Z")

</div>

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](http://www.fapbox.com/svn/fapbox)  
/home/fapb  
ox/releases/20070907194029 && (echo 35 \>  
/home/fapbox/releases/20070907194029/RE  
VISION)”  
servers: [“[www.fapbox.com](http://www.fapbox.com)”]  
Password:  
[[www.fapbox.com](http://www.fapbox.com)] executing command  
command finished
- executing `deploy:finalize\_update’
- executing “chmod -R g+w /home/fapbox/releases/20070907194029”  
servers: [“[www.fapbox.com](http://www.fapbox.com)”]  
[[www.fapbox.com](http://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](http://www.fapbox.com)”]  
[[www.fapbox.com](http://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](http://www.fapbox.com)”]  
[[www.fapbox.com](http://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](http://www.fapbox.com)”]  
[[www.fapbox.com](http://www.fapbox.com)] executing command  
\*\* [out :: [www.fapbox.com](http://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](http://www.fapbox.com)”]  
[[www.fapbox.com](http://www.fapbox.com)] executing command  
command finished  
command “chmod 755 /home/fapbox/releases/20070907194029/script/spin”  
failed on w  
[ww.fapbox.com](http://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}](http://www.fapbox.com/svn/#%7Bapplication%7D)”  
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

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 9, 2007, 12:54am UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/8 "2007-09-09T00:54:31Z")

</div>

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}”, 😊  
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](http://www.fapbox.com/svn/fapbox)  
> /home/fapb  
> ox/releases/20070907194029 && (echo 35 \>  
> /home/fapbox/releases/20070907194029/RE  
> VISION)”  
> servers: [“[www.fapbox.com](http://www.fapbox.com)”]  
> Password:  
> [[www.fapbox.com](http://www.fapbox.com)] executing command  
> command finished
> - executing `deploy:finalize\_update’
> - executing “chmod -R g+w /home/fapbox/releases/20070907194029”  
> servers: [“[www.fapbox.com](http://www.fapbox.com)”]  
> [[www.fapbox.com](http://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](http://www.fapbox.com)”]  
> [[www.fapbox.com](http://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](http://www.fapbox.com)”]  
> [[www.fapbox.com](http://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](http://www.fapbox.com)”]  
> [[www.fapbox.com](http://www.fapbox.com)] executing command  
> \*\* [out :: [www.fapbox.com](http://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](http://www.fapbox.com)”]  
> [[www.fapbox.com](http://www.fapbox.com)] executing command  
> command finished  
> command “chmod 755 /home/fapbox/releases/20070907194029/script/spin”  
> failed on w  
> [ww.fapbox.com](http://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}](http://www.fapbox.com/svn/#%7Bapplication%7D)”  
> 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

---

<div class="post-metadata">

**Author:** ![jnicholson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@jnicholson](https://www.ruby-forum.com/u/jnicholson)\
**Post date:** [September 9, 2007, 12:56am UTC](https://www.ruby-forum.com/t/cannot-run-command-script-spin-premission-denied/114073/9 "2007-09-09T00:56:47Z")

</div>

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
