ping测试局域网内主机是否alive
[root@zabbix ~]# cat alivehost.sh
#!/bin/bash
#Checks to see if hosts 192.168.1.100-192.168.1.200 are alive
for n in {50..150}; do
host=172.16.0.$n
ping -c2 $host &>/dev/null
if [ $? = 0 ]; then
echo "$host is UP"
else
echo "$host is DOWN"
fi
done