0

Sometimes wget just hangs in the middle of a download:

50% [===================>                   ] 500,000  500KB/s  eta 5m 5s

I just end up doing a wget --continue to restart it, and it seems to work for a while til it hangs again.

Wondering (a) if there is a way for it to throw an error in this case, or (b) to automatically restart (maybe with some external wrapping script).

Also if you happen to know a general reason why this might happen or what's happening, that would be interesting to know, but not necessary. Mainly just want to know how to get it to restart (or at least throw an error).

BTW by "hang" I mean it just sits there, nothing changes in the terminal, etc. But it doesn't seem to be causing a memory leak or causing my computer's CPU to be overtaken so it's humming and there's no CPU left. Instead it just sits there and I have to restart it.

I have tried this as well but it doesn't do anything:

wget --continue --tries=0 --read-timeout=10 http://domain.com/foo/bar.zip

Also, I can still be running multiple other wgets at the same time on unrelated domains in different terminal windows, so perhaps it is the domain that is never responding or something. Not sure what to do.

  • The "hang" is most likely caused by the network pipe being broken while Wget still waits for data on one end of it. You can try running strace on the process while its stuck in order to see what it is doing – darnir Nov 13 '18 at 19:30
1

‘--timeout=seconds’

Set the network timeout to seconds seconds. This is equivalent to specifying ‘--dns-timeout’, ‘--connect-timeout’, and ‘--read-timeout’, all at the same time.

https://www.gnu.org/software/wget/manual/wget.html#Basic-Startup-Options

http://man7.org/linux/man-pages/man1/timeout.1.html

while true;do wget -T 15 -c "$URL" && break;done

https://stackoverflow.com/a/30986740/1133275

  • No, this doesn't work. Still having the same issue. – Lance Pollard Nov 7 '18 at 9:54
  • @LancePollard did you try the linked 'timeout' command? because if that is not working your system is broken. – user1133275 Nov 7 '18 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.