Url批量测试脚本1

#!/bin/sh
. /etc/init.d/functions
array=(
http://blog.oldboyedu.com
http://blog.etiantian.org
http://oldboy.blog.51cto.com
http://10.0.0.7
)
function wait(){
    echo -n "Start Curl_check"
    for n in {1..3}
    do
        echo -n " ."
        sleep 1
        if [ $i -eq 4 ];then
            echo -e "\t"
            action "Curl_check is start!!!!!!" /bin/true
        fi
    done
}
function check_url(){
    wget -o /dev/null --spider -T 10 --tries=1  $1 
    if [ $? -eq 0 ];then
        action "$1 is ok" /bin/true
    else
        action "$1 is no" /bin/false
    fi
}
function main(){
    wait
    for((i=0;i<${#array[*]};i++))
    do
        check_url ${array[i]}
        sleep 1
    done
}
main

 

posted @ 2025-09-19 09:04  hopeccie  阅读(4)  评论(0)    收藏  举报