局域网主机存活脚本
局域网主机存活脚本
#!/bin/bash
ping -c 1 192.168.1.55 && echo -e "\033[0;33;1m master server is alive\033[0m"
ping -c 1 192.168.1.155 && echo -e "\033[0;33;1m win server is alive\033[0m"
ping -c 1 192.168.1.250 && echo -e "\033[0;33;1m tpserver server is alive\033[0m"
db_sub_ip=1
dbs=("db1" "db2" "db3")
for (( i = 0 ; i < (${#dbs[@]}) ; i++ ))
do
ping -c 1 192.168.1.20$db_sub_ip && echo -e "\033[0;33;1m ${dbs[$i]} is alive\033[0m"
((db_sub_ip++))
done
echo "-------------------------------------------------------------------------------------------"
server_sub_ip=1
servers=("server1" "server2" "server3")
for((i = 0 ; i < (${#servers[@]}) ; i++))
do
ping -c 1 192.168.1.25$server_sub_ip && echo -e "\033[0;33;1m${servers[$i]} is alive\033[0m"
((server_sub_ip++))
done
上一篇: DataNode的流式接口讲解
下一篇: 应用层协议小结