You need to tell cap to create a pty for each process:

   default_run_options[:pty] = true

Annoying, but some commands that have interactive components (like  
sudo) won't run if they aren't run with a tty.

- Jamis

On Jun 27, 2008, at 2:20 PM, Jamie Orchard-Hays wrote:

>
>
> I'm getting this error when I try to use sudo to copy a file from a
> tmp dir to init.d. I'm using Cap 2.4.1 *without* Cap's deploy file, as
> this is a non-rails deployment. Here's the error:
>
>   * executing "sudo -p 'sudo password: ' cp /var/www/apps/tmp/xtfd /
> etc/init.d/xtfd"
>     servers: ["myserver.com"]
>     [myserver.com] executing command
> *** [err :: myserver.com] sudo:
> *** [err :: myserver.com] sorry, you must have a tty to run sudo
> *** [err :: myserver.com]
>     command finished
> command "sudo -p 'sudo password: ' cp /var/www/apps/tmp/xtfd /etc/
> init.d/xtfd" failed on myserver.com
>
> Here's my task:
>
>
> set :user, "deploy"
> # etc...
>
> namespace :xtf do
>
>   desc "Setup the XTF server, including the init.d/xtfd script"
>   task :setup, :roles => :xtf do
>     file = File.join(File.dirname(__FILE__), "templates", "xtfd")
>     template = File.read(file)
>     buffer = ERB.new(template).result(binding)
>
>     run("mkdir -p #{xtf_tmp}")
>
>     put buffer, "#{xtf_tmp}/xtfd", :mode => 0766
>     sudo("cp #{xtf_tmp}/xtfd #{xtfd}")
>     sudo("rm -f #{xtf_tmp}/xtfd")
>     sudo("chmod 755 #{xtfd}")
>     sudo("#{chkconfig} xtfd on")
>   end
> end
>
> Thanks,
>
> Jamie
>
> >


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to