bash中的多线程卷曲命令 [英] Multithreading curl commands in bash

查看:76
本文介绍了bash中的多线程卷曲命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个shell脚本,它使用域及其参数来查找状态代码。由于线程运行速度更快,但是错过了很多请求。







如果我正常运行它处理所有请求,但速度非常低。有没有一种方法可以保持速度,也不会错过所有请求。



我尝试过:



here is a shell script which takes domain and its parameters to find status code . this runs way faster due to threading but misses lot of requests.



if i ran normally it process all requests but the speed is very low. is there a way through which speed is maintained and it also not misses all requests .

What I have tried:

while IFS= read -r url <&3; 
do while IFS= read -r uri <&4;
 do urlstatus=$(curl -o /dev/null --insecure --silent --head --write-out '%{http_code}' "${url}""${uri}" --max-time 5 ) && 
echo "$url $urlstatus $uri" >> urlstatus.txt & 
done 4<uri.txt
 done 3<url.txt

推荐答案

(curl -o / dev / null --insecure --silent --head --write-out'%{http_code}'
(curl -o /dev/null --insecure --silent --head --write-out '%{http_code}' "


{url}


{uri} - max-time 5)&&
echo
{uri}" --max-time 5 ) && echo "


这篇关于bash中的多线程卷曲命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆