Wednesday, September 21, 2011

Using rsync when scp keeps failing


Sometimes I'm trying to scp a file from a less-than-reliable server that drops my connection so that I can never get the whole thing.  Here is Kem's answer to that problem:


#!/usr/bin/env ruby while true do puts `rsync -av --progress --inplace --rsh='ssh' --bwlimit=100 #{ARGV[0]} #{ARGV[1]}` result = $? if (result.exitstatus == 0) puts "file copy done, exiting" break; end puts "retrying again -- result: #{result}" end

No comments: