IDC production environment detects if IP is in use in shell scripts

Source: Internet
Author: User

#!/bin/bash
#
# ip_check    This shell script takes care of checking all IPAddress.
#
# Create by Xuekun
# date 2015-12-6
# Beijing Open Source
# source function library.
./etc/rc.d/init.d/functions
App_path= ' pwd '
Log_path=${app_path}/ip_check.log
Up_ip_list=${app_path}/up_ip_list.log
DOWN_IP_LIST=$ {app_path}/down_ip_list.log

#init log file
>${log_path}
>${up_ip_list}
>${down_ip_list}
#judge arg

#num IP range
Num=${1}

#main
for ((i=1;i<${num};i++))
do
  echo "#- -------------------------------------# ">>${log_path}
  Ping 10.150.33.${i}-C 3 >>${log_path}
  IF [[$?-eq 0]];then
    echo "10.150.33.${i}" >>${UP_IP_LIST}    < br>  Else
    echo "10.150.33.${i}" >>${DOWN_IP_LIST}    
  fi
Done

This article is from the "Beijing Open source people Linux operation and Maintenance" blog, please be sure to keep this source http://76543211234567.blog.51cto.com/7961566/1769091

IDC production environment detects if IP is in use in 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.