echo $LIST | xargs -I{} -n 1 -P 8 sh -c 'curl -o backup.dump http://url.com'

I am running this for a large amount of files (around 300). After a while, sometimes curl hangs and won't progress for a file. This is problematic because these are all important database dumps. Is there anyway to automatically reset or restart the hanging transfer?

1 Answer 1


You can use combination of timeout and retry options:

curl --max-time <seconds> --retry <num>

--max-time is total time for getting the file.

--retry starts new attempt after either connection error or the timeout.

You might also consider --connect-timeout, --retry-max-time, and --retry-delay options. See man curl for details.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .