#!/bin/bash . /etc/init.d/functions url_list=(www.baidu.com) ChkCurl(){ i=0 while [ $i -lt 2 ] do curl http://${url_list[$i]} &>/dev/null if [ $? -eq 0 ];then action "${url_list[$i]}" /bin/ture else action "${url_list[$i]}" /bin/false fi let i++ done } main(){ while true do ChkCurl sleep 3 done } main