Created
June 12, 2020 23:39
-
-
Save catichenor/c65bb9e727b90b283f2df293afb7cf27 to your computer and use it in GitHub Desktop.
Download a file over HTTP, automatically resume the download if the exit status isn't zero, and restart the download when it stalls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Taken from https://ilovesymposia.com/2013/04/11/automatically-resume-interrupted-downloads-in-osx-with-curl/ and https://ec.haxx.se/usingcurl/usingcurl-timeouts | |
export ec=18; while [ $ec -ne 0 ]; do /usr/bin/curl --speed-time 15 --speed-limit 1000 -O -C - "http://somedomain.com/path/to/some_huge_file.txt"; export ec=$?; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment