2

How could I setup a nice indice on cap:deploy?

I want the remote server to nice the cp commands like so:

nice -n 19 cp ...
Veerendra
  • 2,562
  • 2
  • 22
  • 39

2 Answers2

0

Not sure about cp. Don't you use an SCM?

I tried with my setup (I use subversion) and this seems to work. In deploy.rb, add:

set :scm_command, "nice -19 svn"

It seems somewhat more difficult if you don't use an SCM, you'll have to overload checkout() in deploy/scm/none.rb.

Christian Lescuyer
  • 18,893
  • 5
  • 49
  • 45
0

For those who wants to nice assets:precomile task, the very time consuming task, following worked for me.

namespace :deploy do
  task :map_bins_to_nice  do
    SSHKit.config.command_map.prefix[:rake]&.unshift('nice -n 19')
  end
end

Capistrano::DSL.stages.each do |stage|
  after stage, 'deploy:map_bins_to_nice'
end

Note that this makes every rake task to be niced. E.g. rake db:migrate.

This was originally taken from following post (Japanese). http://d.hatena.ne.jp/nekonokataomoi/20140819/1408443332

Yuki Inoue
  • 3,569
  • 5
  • 34
  • 53