#!/bin/bash #Author Template #Time 2018-07-01 16:00 url_list=( http://www.cnblogs.com/Template/ http://www.baidu.com http://127.0.0.1 ) . /etc/init.d/functions function wait(){ echo -n "3 秒后执行检查." for ((i=0;i<3;i++)) do echo -n "." ;sleep 1 done echo } function check_url(){ wait for ((i=0;i<`echo ${#url_list[*]}`;i++)) do wget -o /dev/null -T 3 --tries=1 --spider ${url_list[$i]} &> /dev/null if [ $? -eq 0 ];then action "${url_list[$i]}" /bin/true else action "${url_list[$i]}" /bin/false fi ((check_count++)) done } main(){ while true do check_url echo "------------check count:${check_count}------------------" sleep 10 done } main
原文地址:https://www.cnblogs.com/Template/p/9250386.html
时间: 2024-10-08 05:52:16