码迷,mamicode.com
首页 > 系统相关 > 详细

IDC生产环境检测IP是否在用的Shell脚本

时间:2016-04-30 01:13:54      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:idc生产环境检测ip是否在用的shell脚本   开源人培训   

#!/bin/bash
#
# ip_check    This shell script takes care of checking all ipaddress.
#
# create by xuekun
# date 2015-12-6
# 北京开源人
# 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}    
  else
    echo "10.150.33.${i}" >>${DOWN_IP_LIST}    
  fi
done

本文出自 “北京开源人Linux运维实战” 博客,请务必保留此出处http://76543211234567.blog.51cto.com/7961566/1769091

IDC生产环境检测IP是否在用的Shell脚本

标签:idc生产环境检测ip是否在用的shell脚本   开源人培训   

原文地址:http://76543211234567.blog.51cto.com/7961566/1769091

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!