Curl:请求之间的休眠/延迟

Curl:请求之间的休眠/延迟,curl,flurry,Curl,Flurry,我正在尝试使用以下命令下载flurry异常日志 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" 它工作正常,根据偏移量(10、

我正在尝试使用以下命令下载flurry异常日志

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"
它工作正常,根据偏移量(10、20、30等)下载csv文件。我想在每个请求之间插入一个延迟。在CURL中可以这样做吗?

使用bash shell(Linux):

这是一个无限循环,延迟由
sleep
命令给出

编辑。在Windows计算机上,您可以改为执行以下操作:

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
)
sleep
命令在Windows上不可用。但是您可以使用
ping
来“模拟”它。只需将上面的XX替换为您想要延迟的秒数。

wget有延迟选项

wget --wait=seconds
还有随机延迟选项

wget --random-wait

在bash中,这将在0-60范围内暂停随机秒数:

for d in {0..100..10}
do
    i=`printf "%03d" $d`
    curl --cookie ./flurry.jar -k -L 'https://dev.flurry.com/exceptionLogsCsv.do?projectID=49999&versionCut=versionsAll&intervalCut=allTime&direction=1&offset='$d --output 'exception'$i'.csv'
    sleep $(($RANDOM*60/32767))
done

我正在使用windows如何在windows中执行此操作。再看看上面的代码,它似乎会一遍又一遍地运行同一个命令,这不是我想要的。命令本身将迭代,因为偏移量=[0-100:10]。我想在命令中提及延迟或睡眠,。是否可能?要在偏移量(10,20,30,…,100)上迭代,请将上面的
(0,0,0)
替换为
(0100,10)
。这意味着从0开始到100,增加10。但它不再是一个无限循环。请将变量%i用于web地址。因此,它将是
…&offset=%i
将代码放在一个.bat文件中,然后直接运行该文件(双击它)。我认为询问者不想永远重新运行
curl
;他想在连续的请求之间设置延迟。
for d in {0..100..10}
do
    i=`printf "%03d" $d`
    curl --cookie ./flurry.jar -k -L 'https://dev.flurry.com/exceptionLogsCsv.do?projectID=49999&versionCut=versionsAll&intervalCut=allTime&direction=1&offset='$d --output 'exception'$i'.csv'
    sleep $(($RANDOM*60/32767))
done