即使我的网络服务器没有运行,我也会收到状态码200.不确定我缺少什么?
# Check URL
status_line=`curl -sL -w "%{http_code}\\n" "http://ipaddress:80" -o /dev/null`
status_code=`echo $status_line | awk '{print $0}'`
echo "STATUS_CODE: ${status_code}"
case "$status_code" in
200) echo 'Success!'
;;
*) echo 'Fail!'
exit 1
;;
esac