curl取得HTTP返回的状态码
curl -I -m 10 -o /dev/null -s -w %{http_code}" " www.baidu.com
-I | 仅测试HTTP头 |
-m 10 | 最多查询10s |
-o /dev/null | 屏蔽原有输出信息 |
-s | silent模式,不输出任何东西 |
-w %{http_code} | 控制额外输出 |
" " | 换行符 |
绑定域名访问服务
curl -I --resolve opsprobe.com:80:192.168.10.10 http://opsprobe.com
--resolve HOST:PORT:ADDRESS,将 HOST:PORT 强制解析到 ADDRESS