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 !

37 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. 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
  4. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks!


    SAP training in Chennai

    ReplyDelete
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. I have read your blog its very attractive and impressive. I like it your blog..Summer Courses in Chennai | Summer Courses in Velachery

    ReplyDelete
  11. 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
  12. 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
  13. 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
  14. 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
  15. Thanks for your post. I’ve been thinking about writing a very comparable post over the last couple of weeks. I’ll probably keep it short and sweet and link to this instead if thats cool. Thanks. lesmeilleurs vpn

    ReplyDelete
  16. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it https://internetprivatsphare.ch/vpn-gutschein/

    ReplyDelete
  17. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing vpn austria

    ReplyDelete
  18. I am doing a report on this subject. Your article is full of really useful information. I will make sure to come back to check out your posts for my next report. https://vpnveteran.com/

    ReplyDelete
  19. I love significantly your own post! I look at all post is great. I discovered your personal content using bing search. Discover my webpage is a great one as you.I work to create several content this post. Once more you can thank you and keep it create! Enjoy! Download Skype For WIndows

    ReplyDelete
  20. This is a truly good site post. Not too many people would actually. the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best. with so much class. If wanted to know more about green smoke reviews. than by all means come in and check our stuff. internet

    ReplyDelete
  21. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon. lemigliorivpn.com

    ReplyDelete
  22. Thanks for your nice post, i am interested to learn online freelancing, but firstly i have to learn computer , could you suggest me please which computer training center best.






    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery

    ReplyDelete
  23. Good to become visiting your weblog again, it has been months for me. Nicely this article that i've been waited for so long. I will need this post to total my assignment in the college, and it has exact same topic together with your write-up. Thanks, good share.
    data science course in India

    ReplyDelete
  24. This article will outline all the different strategies you should be aware of when it comes to soccer.

    Best IAS Coaching In India

    ReplyDelete
  25. Very excellent post!!! Thank you so much for your great content. Keep posting.....

    Spark Training In Bangalore
    Apache Spark Training in Bangalore

    ReplyDelete
  26. IDM download free full version with the serial key from its official website to install it on your computer. Internet Download Manager is not a free program. Internet Download Manager Cracked

    ReplyDelete
  27. Variant: Life's great happiness is to be convinced we are loved. ... To love, and to be loved, is the greatest happiness of existence.Love Is The Supreme Happiness

    ReplyDelete