[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


wget loop

Posted on 2006-04-08
Medium Priority
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 http://server.com/tmp/file1.gz

while [ $X = 1 ]
/usr/bin/wget -r -c -N -l 1 http://server.com/tmp/file1.gz


Question by:bt707
  • 2
  • 2
LVL 51

Expert Comment

ID: 16407604
yes, the while is an infinite loop
LVL 85

Expert Comment

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

Author Comment

ID: 16408993
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

ahoffmann earned 2000 total points
ID: 16410611
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

ID: 16411337
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.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

873 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