wget loop

Posted on 2006-04-08
Last Modified: 2013-12-26
Have a small scipt a friend made for running wget to pull down a file.

can someone explain what the varible here is actually doing, seems to just be keeping the loop going, what's the difference here in using this loop with wget and
just using a straight command to start wget such as

/usr/bin/wget -r -c -N -l 1

while [ $X = 1 ]
/usr/bin/wget -r -c -N -l 1


Question by:bt707
    LVL 51

    Expert Comment

    yes, the while is an infinite loop
    LVL 84

    Expert Comment

    Did you want to set $X depending on the result of the wget?

    Author Comment

    just wanted to verify that the while loop here was set just to be a infinite loop as ahoffmann said.

    used this once to pull a big file to a remote server that has very bad bandwith and connections, worked out good. Just looking for a good way to run wget in a case like this where
    connections are dropped and restarted sometimes, also where the command can be started then the session closed and reopened at a later time to check on the job.


    LVL 51

    Accepted Solution

    not sure if your wget returns an error status for aborted downloads, if so replace the while with:
    while [ $? -ne 0 ]

    if your wget does not report an aborted download, use curl instead

    Author Comment

    thanks ahoffmann, I'll try this out, the wget works really good, I couldn't even kill it witout a kill, did try out a few test and even when killing it
    then restarting it picks up right where it left off, very nice, will look into the curl also, never heard of it.

    Thanks again.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
    Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now