# Weird Capistrano problem

**URL:** <https://www.ruby-forum.com/t/weird-capistrano-problem/61678>\
**Category:** Rails\
**Created:** [May 26, 2006, 1:36am UTC](https://www.ruby-forum.com/t/weird-capistrano-problem/61678 "2006-05-26T01:36:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigcraig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/96bed5/32.png) [@craigcraig](https://www.ruby-forum.com/u/craigcraig)\
**Post date:** [May 26, 2006, 1:36am UTC](https://www.ruby-forum.com/t/weird-capistrano-problem/61678/1 "2006-05-26T01:36:39Z")

</div>

I’m having problems launching the spin process via the deploy.rb task.

Everything works great when is run the script manually via:

% ssh removed\_email\_address@domain.invalid /Web/Rails/Example/current/script/spin

However, when I run ‘cap spinner’ or ‘rake remote:exec ACTION=spinner’,  
I get the following errors:

% cap spinner  
loading configuration  
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/recipes/standard.rb  
loading configuration ./config/deploy.rb

- executing task spinner
- executing “/Web/Rails/Example/current/script/spin”  
servers: [“[monterey.example.net](http://monterey.example.net)”]  
Password:  
[[monterey.example.net](http://monterey.example.net)] executing command  
\*\* [out :: [monterey.example.net](http://monterey.example.net)]  
/Web/Rails/Example/current/script/process/…/…/config/boot.rb:6:in  
`require' **[out :: monterey.example.net] :** [out :: monterey.example.net] No such file to load -- pathname **[out :: monterey.example.net] (** [out :: monterey.example.net] LoadError **[out :: monterey.example.net] )** [out :: monterey.example.net] from /Web/Rails/Example/current/script/process/../../config/boot.rb:6 ** [out :: monterey.example.net] from /Web/Rails/Example/current/script/process/spinner:2:in `require’  
\*\* [out :: [monterey.example.net](http://monterey.example.net)] from  
/Web/Rails/Example/current/script/process/spinner:2  
command finished  
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/command.rb:45:in  
`process!': command "/Web/Rails/Example/current/script/spin" failed on monterey.example.net (RuntimeError) from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:176:in `run’  
from  
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:425:in  
`execute_on_servers' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:173:in `run’  
from ./config/deploy.rb:106:in `load' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:125:in `spinner’  
from  
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:246:in  
`execute_recipes!' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:246:in `execute\_recipes!’  
from  
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:221:in  
`execute!' from /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/cli.rb:12:in `execute!’  
from  
/opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/bin/cap:11  
from /opt/local/bin/cap:18

Why would the require ‘pathname’ fail for cap and not ssh? It is my  
understanding that the deployment tasks are all handled by ssh…

For completeness, here is my spin script:

#!/bin/bash  
/Web/Rails/Example/current/script/process/spinner   
-c ‘/Web/Rails/Example/current/script/process/spawner -p 7000 -i 5’  
  
-d

And the deploy.rb task:

desc “Start the spinner daemon”  
task :spinner, :roles =\> :app do  
run “#{current\_path}/script/spin”  
end

Pretty much the same as the Capistrano docs.

Any help or suggestions would be greatly appreciated.

-ch

---

<div class="post-metadata">

**Author:** ![craigcraig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/96bed5/32.png) [@craigcraig](https://www.ruby-forum.com/u/craigcraig)\
**Post date:** [May 26, 2006, 1:56am UTC](https://www.ruby-forum.com/t/weird-capistrano-problem/61678/2 "2006-05-26T01:56:28Z")

</div>

Craig H. wrote:

> Why would the require ‘pathname’ fail for cap and not ssh? It is my  
> understanding that the deployment tasks are all handled by ssh…

Capistrano doesn’t open a login shell, so you don’t have access to the  
environment set in your .profile or .bashrc files. ssh does.

–

Ray

---

<div class="post-metadata">

**Author:** ![craigcraig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/96bed5/32.png) [@craigcraig](https://www.ruby-forum.com/u/craigcraig)\
**Post date:** [May 26, 2006, 2:31am UTC](https://www.ruby-forum.com/t/weird-capistrano-problem/61678/3 "2006-05-26T02:31:20Z")

</div>

Ray B. wrote:

> Craig H. wrote:
> 
> > Why would the require ‘pathname’ fail for cap and not ssh? It is my  
> > understanding that the deployment tasks are all handled by ssh…
> 
> Capistrano doesn’t open a login shell, so you don’t have access to the  
> environment set in your .profile or .bashrc files. ssh does.

Ray, thanks for the info. I was just about to figure that out for myself  
– was reading the bash man page when I checked the forum. 🙂

So what is the best way to adjust my PATH so that the spin and the  
script/process stuff works?

I can change my spinner task to:

```
run "source ~/.profile && #{current_path}/script/spin"

```

But I still have problems with the built-in restart task.

Is there some way to hook into the run command (e.g. before\_run) or  
should I just rewrite the restart task?

-ch

---

<div class="post-metadata">

**Author:** ![craigcraig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/96bed5/32.png) [@craigcraig](https://www.ruby-forum.com/u/craigcraig)\
**Post date:** [May 26, 2006, 3:58pm UTC](https://www.ruby-forum.com/t/weird-capistrano-problem/61678/4 "2006-05-26T15:58:25Z")

</div>

How do i unsubscribe from this list

> > > understanding that the deployment tasks are all handled by ssh…  
> > > I can change my spinner task to:  
> > > –  
> > > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Take charge with a pop-up guard built on patented Microsoft® SmartScreen  
Technology.  
[http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market\_MSNIS\_Taglines](http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines)  
Start enjoying all the benefits of MSN® Premium right now and get the  
first two months FREE\*.

---

<div class="post-metadata">

**Author:** ![craigcraig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/96bed5/32.png) [@craigcraig](https://www.ruby-forum.com/u/craigcraig)\
**Post date:** [May 26, 2006, 4:30pm UTC](https://www.ruby-forum.com/t/weird-capistrano-problem/61678/5 "2006-05-26T16:30:14Z")

</div>

As seen on all emails showing here.

[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

At the bottom of the page.

On 5/26/06, Step M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > Craig H. wrote:  
> > > So what is the best way to adjust my PATH so that the spin and the
> 
> Take charge with a pop-up guard built on patented Microsoft(r) SmartScreen  
> Technology.  
> [http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market\_MSNIS\_Taglines](http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines)  
> Start enjoying all the benefits of MSN(r) Premium right now and get the  
> first two months FREE\*.
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![craigcraig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/96bed5/32.png) [@craigcraig](https://www.ruby-forum.com/u/craigcraig)\
**Post date:** [May 26, 2006, 11:54am UTC](https://www.ruby-forum.com/t/weird-capistrano-problem/61678/6 "2006-05-26T11:54:11Z")

</div>

You might also run into a problem with the spawner not starting if  
executed via capistrano unless it is prepended with a nohup to force  
it to continue to run after cap exists. See our full technoweenie  
discussion with solution and example: [http://rails.techno-weenie.net/](http://rails.techno-weenie.net/)  
question/2006/5/23/capistrano\_wont\_spawn\_fcgi\_processes

There has also been a ticket around: [http://dev.rubyonrails.org/](http://dev.rubyonrails.org/)  
ticket/4832

Sebastian
