# Cap deploy problem

**URL:** <https://www.ruby-forum.com/t/cap-deploy-problem/87437>\
**Category:** Deployment\
**Created:** [March 2, 2007, 4:47pm UTC](https://www.ruby-forum.com/t/cap-deploy-problem/87437 "2007-03-02T16:47:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![al-evans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@al-evans](https://www.ruby-forum.com/u/al-evans)\
**Post date:** [March 2, 2007, 4:47pm UTC](https://www.ruby-forum.com/t/cap-deploy-problem/87437/1 "2007-03-02T16:47:21Z")

</div>

Can anybody tell me what’s happening here?

I can do this, with the expected results:

ssh -l somename [dir2.com](http://dir2.com) cd /var/www/dir1/dir2/current && ls -l

But then I do something similar via Capistrano I get an error at the  
end…

- executing task symlink
- executing “ln -nfs /var/www/dir1/dir2/releases/20070302122224  
/var/www/dir1/dir2/current”  
servers: [“[dir2.com](http://dir2.com)”]  
[[dir2.com](http://dir2.com)] executing command  
command finished
- executing task restart
- executing task restart\_mongrel\_cluster
- executing “mongrel\_rails cluster::restart -C  
/var/www/dir1/dir2/current/config/mongrel\_cluster.yml”  
servers: [“[dir2.com](http://dir2.com)”]  
[[dir2.com](http://dir2.com)] executing command  
\*\* [out :: [dir2.com](http://dir2.com)] Stopping 3 Mongrel servers…  
\*\* [out :: [dir2.com](http://dir2.com)] Starting 3 Mongrel servers…  
command finished
- executing task after\_restart
- executing task restart\_backgroundrb
- executing task stop\_backgroundrb
- executing “cd /var/www/dir1/dir2/current && script/backgroundrb stop”  
servers: [“[dir2.com](http://dir2.com)”]  
[[dir2.com](http://dir2.com)] executing command  
command finished
- executing task start\_backgroundrb
- executing “RAILS\_ENV=production nohup cd /var/www/dir1/dir2/current  
&& script/backgroundrb start”  
servers: [“[dir2.com](http://dir2.com)”]  
[[dir2.com](http://dir2.com)] executing command  
\*\* [out :: [dir2.com](http://dir2.com)] nohup:  
\*\* [out :: [dir2.com](http://dir2.com)] appending output to `nohup.out' **[out :: dir2.com] nohup:** [out :: dir2.com] cannot run command `cd’  
\*\* [out :: [dir2.com](http://dir2.com)] : No such file or directory

I can give the same command from an ssh login shell and it works as  
expected.

Clues for the clueless?

–Al Evans

---

<div class="post-metadata">

**Author:** ![al-evans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@al-evans](https://www.ruby-forum.com/u/al-evans)\
**Post date:** [March 3, 2007, 4:43am UTC](https://www.ruby-forum.com/t/cap-deploy-problem/87437/2 "2007-03-03T04:43:09Z")

</div>

This is the command that is failing:

RAILS\_ENV=production nohup cd /var/www/dir1/dir2/current &&  
script/backgroundrb start

I believe this will fail if you run it directly as well.

Try changing it to this:  
export RAILS\_ENV=production && cd /var/www/dir1/dir2/current && nohup  
script/backgroundrb start

(You may also need to add an ‘&’ to the end.)

Shawn Balestracci

---

<div class="post-metadata">

**Author:** ![al-evans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@al-evans](https://www.ruby-forum.com/u/al-evans)\
**Post date:** [March 3, 2007, 5:02pm UTC](https://www.ruby-forum.com/t/cap-deploy-problem/87437/3 "2007-03-03T17:02:10Z")

</div>

Vegan Buddy wrote:

> Try changing it to this:  
> export RAILS\_ENV=production && cd /var/www/dir1/dir2/current && nohup  
> script/backgroundrb start

Thanks! That worked great.

> (You may also need to add an ‘&’ to the end.)

That isn’t necessary with the current version of backgroundrb.

Again, thank you for your help.

–Al Evans
