#!/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
时间: 2024-10-19 13:10:49