tags:

views:

296

answers:

1

I've written a shell script that has a function like this:

function getpage {
        echo $1
        curl -O "http://www.example.com/$1" -b cookie.txt -s
}

The problem is if the website times out then that page will be skipped, I need it to re-try if it times out (I will also be putting in a 60 second timeout).

How do I do this?

A: 

You can use --retry <num> for forced retries. An alternate way is to add -w http_code to see what the return code is...if it's not 200 then try again.

Andrew Sledge
now why dint I think of that, timeout value of 10 seconds with 50 retries (I highly doubt it will ever need more than 3 though)
Hintswen