I'd like to do the same as I could do with Capistrano2
task :memory do
run "free | awk '/^Mem:/{print $4}'" do | channel, stream, data |
puts "host: #{channel[:host]} has free memory of #{data.to_i/1024} MB"
end
end
Using capture wont help as it only prints after the remote command has finished.