• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1814
  • Last Modified:

wget loop

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


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



Thanks,

0
bt707
Asked:
bt707
  • 2
  • 2
1 Solution
 
ahoffmannCommented:
yes, the while is an infinite loop
0
 
ozoCommented:
Did you want to set $X depending on the result of the wget?
0
 
bt707Author Commented:
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.

Thanks,

0
 
ahoffmannCommented:
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
0
 
bt707Author Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now