curlflurry

Curl: sleep/delay between requests


I am trying to download flurry exception logs using the following command.

curl --cookie ./flurry.jar -k -L "https://dev.flurry.com/exceptionLogsCsv.do?projectID=49999&versionCut=versionsAll&intervalCut=allTime&direction=1&offset=[0-100:10]" --output "exception#1.csv"

It works fine and it downloads the csv files based on the offset(10,20,30 etc). I would like to insert a delay between each request. Is it possible to do that in CURL?


Solution

  • Using bash shell (Linux) :

    while :
    do
        curl --cookie ./flurry.jar -k -L "https://dev.flurry.com/exceptionLogsCsv.do?projectID=49999&versionCut=versionsAll&intervalCut=allTime&direction=1&offset=[0-100:10]" --output "exception#1.csv"
        sleep 5m
    done
    

    It is an infinite loop, and the delay is given by the sleep command.

    Edit. On Windows machine, you can do this trick instead :

    for /L %i in (0,0,0) do (
        curl --cookie ./flurry.jar -k -L "https://dev.flurry.com/exceptionLogsCsv.do?projectID=49999&versionCut=versionsAll&intervalCut=allTime&direction=1&offset=[0-100:10]" --output "exception#1.csv"
        ping -n XX 127.0.0.1>NUL
    )
    

    The sleep command is not available on Windows. But you can use ping to "emulate" it. Just replace the XX above with the number of seconds you want to delay.