#! /bin/bash . /etc/init.d/functions url_list=( http://www.baidu.com http://www.123.com http://www.sohu.com )

wait() { echo -n "please waiting" for ((i=0;i<3;i++));do echo -n ".";sleep 1 done }

check_website() { 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 done }

main() { check_website }

main