Ubuntu device IP continuous ping check script

Ubuntu device IP continuous ping check script


foreword

Since the work project needs to check whether more than 30 devices are running normally and whether the delay is large, the operating environment is the Ubuntu system, so a script is written to provide a quick check;

The script content is as follows:

#!/bin/bash
##ping IP BY-Holden
echo -e "\033[43;30m =====>             连接检查               <===== \033[0m"
ip=64
while [ $ip != "96" ]; do
ping 10.151.23.$ip -c 2 | grep -q "time=0." && echo -e "\033[32m 10.151.23.$ip OK\033[0m" || echo -e "\033[31m 10.151.23.$ip 不通或延时很高\033[0m"
ip=`expr "$ip" "+" "1"`
done

Guess you like

Origin blog.csdn.net/m0_54792870/article/details/122340042