Downloading a file over an unstable connection with wget
I’m currently downloading a very big file (15GB) over a slow and unstable connection, so I was looking for a way to resume the download if the connection stalled or if I had to disconnect my notebook for some time.
I ended up using good old wget with the following options:
-
wget -c –tries=0 –retry-connrefused –timeout=2 –wait=1 \
-
http://www.schmidp.com/bigfile
-c tells wget to continue a download, so you can stop wget and restart it later without downloading the whole file again.
–tries=0 means that we will try indefinitely if the connection breaks
–retry-connrefused forces wget to retry even if the server is currently not listening
–timeout=2 tells wget to reconnect if we don’t get any data for more than 2 seconds
–wait=1 means wget will sleep 1 second before it reconnects