码迷,mamicode.com
首页 > 其他好文 > 详细

检查ip是否在使用

时间:2015-09-10 17:43:39      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:ping




cat /tmp/checkaliveip.sh 

#!/bin/bash


for num in {1..254}

do

(

        Host=192.168.110.$num

#       ping -c2 $Host &> /dev/null

        ping -c 2 -i 0.2 -w 3 $Host &> /dev/null

        [ $? -eq 0 ] && echo -e "\t##########\t\e[0;5m\e[32m$Host is alive.\e[0m\t############"

        [ $? -ne 0 ] && echo -e "\t\t\t\t\t\t\t\t\t\t---------------\t\e[0;5m\e[4m\e[31m$Host is down.\e[0m\t-----------------"

) #&

done





本文出自 “勿忘初心” 博客,请务必保留此出处http://winterysea.blog.51cto.com/9677346/1693405

检查ip是否在使用

标签:ping

原文地址:http://winterysea.blog.51cto.com/9677346/1693405

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