Check URL address script

Source: Internet
Author: User

Method One:

1[[Email protected] script]#VI check_url_01.sh2 3 #!/bin/sh4 #This script was created by Nulige5 #Check URL Add6 #version1.17. /etc/init.d/functions8 9url_list=(Ten/HTTPwww.baidu.com One/HTTPwww.qq.com Ahttp://192.168.146.128 - ) -  the function Wait () - { -Echo-n'after 3 seconds, perform the operation'; -     for(i=0; i<3; i++)) +  Do -Echo-n"."; Sleep 1 +  Done A Echo at } -  - function Check_url () { -Set-x - wait -Set +x inEcho'Check URL ...' -      for(i=0; i<${#url_list[*]}; i++)) to  Do +     #http/1.1 OK -Judge= ($ (curl-i-S ${url_list[$i]}|head-1|tr"\ r" "\ n")) the     if[["${judge[1]}"==' $'&&"${judge[2]}"=='OK' ]] *  Then $Action"${url_list[$i]}"/bin/truePanax Notoginseng  Else -Action"${url_list[$i]}"/bin/false the fi +  Done A     } theCheck_url

Execution Result:

1 [[email protected] script]#23 seconds later, do the operation; 3 Check URL ... 4 /www.baidu.com [OK]5 http/www.qq.com [OK]6 /http 192.168.1.7 [OK]

Check URL address script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.