shell curl 状态码与内容等脚本

shell脚本

vim check_url.sh

#!/bin/bash

while true;do

#echo "xxxx"
da=`date +%F-%H-%M-%S`
ret=`curl -o $da -s -w %{http_code}:%{time_connect}:%{time_starttransfer}:%{time_total} $1`
echo "$da,$ret">>ret.log
sleep 1

done

运行脚本:

bash -x  check_url.sh http://www.baidu.com

效果

说明 :

http_code :http状态码
time_connect: 连接 时间
time_total: 总的时间 ,也就是request_time

2022-03-31-17-00-*文件是返回 内容

分享1个命令:

清空文件
 find /tmp/1.txt|awk '{print "echo >"$0}'|bash
posted @   清风木  阅读(235)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示