利用curl监控网络
curl -o /dev/null -s -w %{http_code}:%{time_connect}:%{time_starttransfer}:%{time_total} https://www.elooy.com;
-o /dev/null
丢弃输出-s
静默模式-w
格式化输出, 变量有url_effective, http_code, http_connect, time_total,time_namelookup, time_connect, time_appconnect, time_pretransfer, time_redirect,time_starttransfer, size_download, size_upload, size_header, size_request, speed_download, speed_upload, content_type,num_connects, num_redirects, redirect_url, ftp_entry_path, ssl_verify_result
# 每隔5秒访问一次
while true; do curl -o /dev/null -s -w %{http_code}:%{time_connect}:%{time_starttransfer}:%{time_total} https://www.elooy.com; echo;sleep 5;done