检查URL的可用性脚本
#!/bin/bash check_url() { HTTP_CODE=$(curl -o /dev/null --connect-timeout 3 -s -w "%{http_code}" $1) if [ $HTTP_CODE -ne 200 ];then echo "Warning: $1 Access failure!" fi } check_url www.baidu.com
#!/bin/bash check_url() { HTTP_CODE=$(curl -o /dev/null --connect-timeout 3 -s -w "%{http_code}" $1) if [ $HTTP_CODE -ne 200 ];then echo "Warning: $1 Access failure!" fi } check_url www.baidu.com