#!/bin/bash
for ip in `cat /root/ip.txt`
do
ping -c1 $ip > /dev/null
if [ $? -eq 0 ];then
echo "$ip is up."
else
echo "$ip is down."
fi
done
将需要查看主机IP 写入 /root/ip.txt 文件
#!/bin/bash
for ip in `cat /root/ip.txt`
do
ping -c1 $ip > /dev/null
if [ $? -eq 0 ];then
echo "$ip is up."
else
echo "$ip is down."
fi
done
将需要查看主机IP 写入 /root/ip.txt 文件