网站地图    收藏   

主页 > 后端 > 网站安全 >

Linux shell 检测内网中存活主机 - 网站安全 - 自学

来源:自学PHP网    时间:2015-04-17 13:03 作者: 阅读:

[导读] #!/bin/bash# Simple SHELL script for Linux and UNIX system monitoring with# ping command# code by robertfor ((a=1;a=255;a++));doHOSTS=192.168.132.$aCOUNT=1for myhost in $HOST......

#!/bin/bash
# Simple SHELL script for Linux and UNIX system monitoring with
# ping command
# code by robert
for ((a=1;a<=255;a++));do
HOSTS="192.168.132.$a"
COUNT=1
for myhost in $HOSTS
do
  count=$(ping -c $COUNT $myhost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -eq 0 ]; then # 100% failue
        echo "$myhost is down (ping failed)"
                else
                        echo "$myhost is up"
                fi
done
done

摘自 Robert's Blog

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论