Hi Nam-Luc,

Why not use this simplified command-line?

# Note: I replaced %Q{ by %Q[ for readability
task :set_apt_cache, :roles => :arom_slaves do
  run %Q[ #{sudo} echo 'Acquire::http { Proxy "http://192.168.0.210:3142;";
};' >> /etc/apt/apt.conf.d/90-apt-proxy.conf ]
end


As usually... not tested :)

Regards


2012/10/16 Nam-Luc Tran <[email protected]>

> Hello,
>
> I need to set up a very simple task which involves writing a line in a
> file with su permissions. So far, I have managed to write something like
> this:
>
> task :set_apt_cache, :roles => :arom_slaves do
>   run %Q{#{sudo} sh -c %Q{echo 'Acquire::http { Proxy "
> http://192.168.0.210:3142;"; };' >> /etc/apt/apt.conf.d/90-apt-proxy.conf}}
> end
>
> but I keep on getting the following error:
> "sh: 1: cannot create /etc/apt/apt.conf.d/90-apt-proxy.conf}: Permission
> denied"
>
> Could you help me point out what is wrong in my task?
>
> Cheers,
>
> --
> * You received this message because you are subscribed to the Google
> Groups "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to
> [email protected] For more options, visit this
> group at http://groups.google.com/group/capistrano?hl=en

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to