curl 判断网址可用脚本

判断网址是否可用

#!/bin/bash
.  /etc/init.d/functions
check_fun(){
url_list=(www.baidu.com www.tudou.com www.youku.com www.xxx222.com)
for i in ${url_list[@]}
do
         curl -s -o /dev/null http://$i
         if [ $? -eq 0 ];then
                action "$i" /bin/true
        else
                action "$i" /bin/false
        fi
done
}
while :
do
        check_fun
        sleep 3
done
posted @ 2020-01-06 09:16  Databasess  阅读(571)  评论(0编辑  收藏  举报