复制代码 代码如下:
#!/bin/bash
#********************************#
#2013-01-11 17:00:00 wanggy exp #
#note:ping monitor #
#********************************#
set -u
ping_fun()
{
d_network=192.168.1
echo -n "input the network(default $d_network):"
read network
: ${network:=$d_network}
echo "network:$network"
d_hostip_beg=1
d_hostip_end=254
echo -n "input the hostip(default $d_hostip_beg $d_hostip_end):"
read hostip_beg hostip_end
: ${hostip_beg:=$d_hostip_beg}
: ${hostip_end:=$d_hostip_end}
echo "hostip_beg:$hostip_beg"
echo "hostip_end:$hostip_end"
if [ $hostip_beg -gt $hostip_end ];then
echo "$hostip_beg greater than $hostip_end!!!"
exit 0
fi
: >pinglog
: >pingerrlog
ping_count=3
for ((hostip=$hostip_beg;hostip<=$hostip_end;hostip++));do
{
host=$network.$hostip
echo "开始ping检测$host"
ping -c $ping_count $host >/dev/null
if [ $? = 0 ];then
echo "$host is up"
echo "$host is up" >>pinglog
else
echo "$host is down"
echo "$host is down" >>pingerrlog
fi
}&
done
wait
}
main()
{
echo "----开始执行ping程序----"
ping_fun
}
main
exit 0
最近发表
- Centos7 metasploit-framework安装部署
- 记录systemd内存占用过多
- 错误提示open_basedir restriction in effect. File is not within the allowed path:的解决方法
- EUserv自动续期shell脚本配合crontab
- Elasticsearch 7.9.1集群安装配置
- 判断磁盘空间使用率是否达到阈值shell脚本
- TypeError: Unicode-objects must be encoded before hashing
- Unverified HTTPS request is being made
- Centos7 部署DHCP服务
- LVS负载调度NAT及DR教程
标签列表
- win11 (20)
- win11教程 (20)
- win11桌面 (1)
- 远程桌面 (1)
- 远程链接 (1)
- 清理缓存 (1)
- Win11如何设置右键经典模式 (2)
- Win11右键怎么设置原来的模样 (2)
- Win11图标 (2)
- Win11 (4)
- 本地磁盘 (1)
- win11正式版退回win10 (1)
- win10 (1)
- 管理员权限 (1)
- 帝国cms教程 (36)
- 火焰效果 (2)
- 火焰制作 (2)
- 火焰动图 (2)
- ps教程 (9)
- Office 2010 (2)
- Office2010 (2)
- Office2010激活 (2)
- Office2007 (4)
- Office2007安装 (4)
- Office2007激活 (4)
