我想同时运行多个 cURL 命令(命令示例如下)。这样做的最佳方法是什么?可以做成.bat吗?
curl -H "authorization:apikey" https://ckan/data/api/action/resource_update -v --form id="resource1" --form upload=@"dataset1.csv"
curl -H "authorization:apikey" https://ckan/data/api/action/resource_update -v --form id="resource2" --form upload=@"dataset2.csv"
curl -H "authorization:apikey" https://ckan/data/api/action/resource_update -v --form id="resource3" --form upload=@"dataset3.csv"
curl -H "authorization:apikey" https://ckan/data/api/action/resource_update -v --form id="resource4" --form upload=@"dataset4.csv"
要发送多个同时 cURL 请求,您可以复制此行
for i in $(seq 30); do $(sleep $i > /dev/null 2>&1 &) ; done ;
来并行化您指定的连接数,将 sleep $i
替换为您的命令,它就会起作用。