Created
September 18, 2014 09:24
-
-
Save creativetechnologist/ab94c3d5ce65b42bb43c to your computer and use it in GitHub Desktop.
JDW SFTP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ftpupload.how_many_retries.times do | |
begin | |
Net::SFTP.start(ftpupload.host, ftpupload.username) do |sftp| | |
sftp.upload!(filename, "/") | |
AdminMailer.notifyadmins("Succesfully sent File to JDW","Sent File to JDW: #{filename}").deliver | |
puts "sent file up" | |
end | |
break | |
rescue Exception=>e | |
# Error | |
AdminMailer.notifyadmins("Error Sending File to JDW","#{e}. Will retry in #{ftpupload.seconds_sleep_between_retries} seconds. #{filename}").deliver | |
puts "\tCaught: #{e} waiting to retry" | |
sleep ftpupload.seconds_sleep_between_retries | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment