标签:shell
#!/bin/sh
[ -e /etc/init.d/functions ]&& . /etc/init.d/functions || exit 0
if [ $? -eq 0 ];then
for i in $(seq 1 1 255)
do
IP="172.20.100."
ping -c 1 $IP$i &>/dev/null
if [ $? -eq 0 ];then
action "ping $IP$i ok!" /bin/true &>>pingOK.txt
echo "#########################################" &>>pingOK.txt
else
action "ping $IP$i error!" /bin/false &>>pingERROR.txt
echo "#########################################" &>>pingERROR.txt
fi
echo "ping ip:172.20.100.1-255 ok!"
done
else
echo "reload /etc/init.d/functions file error!"
fi
标签:shell
原文地址:http://12187655.blog.51cto.com/12177655/1920704