Common shell Scripts

Source: Internet
Author: User

#!/bin/bash # Check if the 192.168.1.1-192.168.1.254 host is alive

For IP in 192.168.1. {1..254};

Do

If ping-c 1 $ip >/dev/null; Then

echo "$ip OK."

Else

echo "$ip no!"

Fi

Done




#!/bin/bash #检查多个域名是否可以访问

Url= "www.baidu.com www.sina.com www.jd.com"

for URL in $URL; Do

http_code=$ (Curl-o/dev/null-s-w%{http_code}/HTTP $url)

If [$HTTP _code-eq 200-o $HTTP _code-eq 301]; Then

echo "$url OK."

Else

echo "$url no!"

Fi

Done



This article is from "Flying Little Demon" blog, please make sure to keep this source http://065432.blog.51cto.com/3079397/1940815

Common shell Scripts

Related Article

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.