Wednesday, January 7, 2015

Downloading a File in an Unreliable/Flaky Connection

Many of us find ourselves stuck in a place where we have a very unreliable/flaky connection and need to download a file urgently. Most likely you don't have an external download manager (those were popular in age of IE 6), and using a browser to download restarts the download from beginning every time. With a lot of luck you hope the download is successful this time. I went through the same when I spent my New Year holidays with family in a not so connected to internet part of India.

Obviously, one such solution that props to mind is using curl with "-C" continue the download flag. So using curl your command is going to look like

curl -L -O http://xyz.url

and when the download has failed, switch over to command

curl -L -O -C - http://xyz.url

But this have another problem. You have to constantly monitor the download and launch the command as soon as it craps. Curl helps you by returning an error exit value if the download was not successful and otherwise. Wish there was a command to relaunch it based on the exit flag. Since there is none, ruby can come to your rescue. We can write a small ruby script to do just that. The ruby script looks like

ruby -e "while(\!system(\"curl -L -O -C - http://xyz.url\")); end"

Hope this helps. Happy New Year !

30 comments:

  1. Another interesting information,thanks for sharing that valuable information.I can easily understand all given information.It is more helpful information.
    ios training

    ReplyDelete
  2. Fantastic write-up together with excellent website,Outbound Calling App I enjoy these kinds of challenging content articles keep this specific somebody.

    ReplyDelete

  3. This content creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.


    SAP training in Chennai

    ReplyDelete

  4. First is to thank you for all this informative posts you give us for free; i bet all of us are happy.
    Such a great idea of yours! You have been a big help for me. Thanks a lot. more post for interesting topic. Great!

    SAP training in Chennai

    ReplyDelete
  5. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks!


    SAP training in Chennai

    ReplyDelete

  6. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.

    SAP training in Chennai

    ReplyDelete
  7. This topic has always been one of my favorite subjects to read about. I have found your post to be very rousing and full of good information. I will check your other articles shortly.
    Go Viral

    ReplyDelete

  8. Great and useful article. Creating content regularly is very tough. Your points are motivated me to move on.


    SEO Company in Chennai

    ReplyDelete
  9. Very well said. Yeah, speaking about IT and keeping our planet green. You should definitely do a research about data room providers. It's very convenient to store your documents online.

    ReplyDelete
  10. This is a really good read for me. Must agree that you are one of the coolest blogger I ever saw. Thanks for posting this useful information. This was just what I was on looking for. Best Browser for mac

    ReplyDelete
  11. Plenty of clicks are made on the torrent websites by many people round the world to download the favorite torrents. VPN for omegle.com

    ReplyDelete
  12. Thanks for sharing such a wonderful and interesting blog with smart content..keep updating..
    Diploma Project Center in Chennai | Final Year Project Center in Chennai

    ReplyDelete
  13. Catering Corporate and Business Events Thanks for sharing the article. Keep updating more with us.

    ReplyDelete
  14. I have read your blog its very attractive and impressive. I like it your blog..Summer Courses in Chennai | Summer Courses in Velachery

    ReplyDelete
  15. I have a mission that I’m just now working on, and I have been at the look out for such information iii host

    ReplyDelete
  16. I believe that there would be great opportunities for those who are coming around this area. Thanks for posting...
    Best Online Software Training Institute | RPA Training

    ReplyDelete
  17. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    Selenium Training in Chennai | Selenium Training in Bangalore | Selenium Training in Pune | Selenium online Training

    ReplyDelete
  18. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.


    AWS Training in Velachery | Best AWS Course in Velachery,Chennai

    Best AWS Training in Chennai | AWS Training Institutes |Chennai,Velachery

    Amazon Web Services Training in Anna Nagar, Chennai |Best AWS Training in Anna Nagar, Chennai

    Amazon Web Services Training in OMR , Chennai | Best AWS Training in OMR,Chennai

    ReplyDelete
  19. After seeing your article I want to say that the presentation is very good and also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
    Java training in Chennai | Java training institute in Chennai | Java course in Chennai

    Java training in Bangalore | Java training institute in Bangalore | Java course in Bangalore

    Java online training | Java Certification Online course-Gangboard

    Java training in Pune

    ReplyDelete
  20. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa training in velachery| rpa training in tambaram |rpa training in sholinganallur | rpa training in annanagar| rpa training in kalyannagar

    ReplyDelete
  21. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    python course institute in bangalore
    python Course in bangalore
    python training institute in bangalore

    ReplyDelete
  22. Best, Live RPA Online Training In USA,Hyderabad | Online RPA Training In USA, Hyderabad
    Click Here Best RPA Online Training to go to RPA Online Training Institute Details.

    ReplyDelete
  23. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Best Devops training in sholinganallur
    Devops training in velachery
    Devops training in annanagar
    Devops training in tambaram

    ReplyDelete