您的位置:首页 > 其它

检查ip是否在使用

2015-09-10 12:55 253 查看
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\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\e[0;5m\e[4m\e[31m$Host is down.\e[0m\t-------------"
) #&
done

本文出自 “勿忘初心” 博客,请务必保留此出处http://winterysea.blog.51cto.com/9677346/1693405
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: