Using shell scripting to ping Check network connectivity between the blade server and the primary server

Source: Internet
Author: User

In order to check the network connection status between the daq01 and the blade server,

1. Use the output rule of ping command, if can ping pass, will output 0% packet loss value; If you cannot ping the pass, the 0% packet loss is not output

2. If the ping command output 0% packet loss successful execution, the network connection is OK, otherwise the network connection is not

3. && in Shell scripts | | For use, refer to 20360107

Command1 && Command2

Indicates: If Command1 execution succeeds && executes Command2

Command1 | | Command2

Indicates: if Command1 execution Fails | | Then execute Command2

4. The hostname of the blade server can be grep from the/etc/hosts file

Script content:

1 #!/bin/bash2 3 host= ' grep cmm03node/etc/hosts |awk ' {print $} '4 5 for line in $host 6 Do7     ping-c 3 $l ine | Grep-q "0% packet loss" && echo "$line OK" | | echo "$line fail" 8   Done

The results are as follows:

Ping. SH cmm03node01 okcmm03node02 okcmm03node03 okcmm03node04 okcmm03node05 okcmm03node06 OKcmm03node07 OKcmm03node08 Okcmm03node09 okcmm03node10 okcmm03node11 okcmm03node12 okcmm03node13 okcmm03node14 OK

Description The network between the DAQ01 and the blade server is normal!

Using shell scripting to ping Check network connectivity between the blade server and the primary server

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.