In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Do ping cycle test through shell script
System environment:
Operating system: MAC OS
An interesting and useful system maintenance script that tests the connectivity of network hosts through shell script:
[tiany@localhost ~] $cat ping.sh
#! / bin/bash
For i in `seq 254`
Do
Ip=192.168.1.$i
Ping-C1 $ip > / dev/null 2 > & 1
[$?-eq 0] & & echo "$ip is alive" | | echo "$ip is not alive"
Done
[tiany@localhost ~] $sh ping.sh
192.168.1.1 is alive
192.168.1.2 is not alive
192.168.1.3 is not alive
192.168.1.4 is not alive
192.168.1.5 is not alive
192.168.1.6 is not alive
Transfer to another:
Use shell script to implement all hosts in the ping network segment:
#! / bin/sh
# ping all host
# edit by www.jbxue.com
# find from / etc/hosts for host info,and filter IP address
Cat / etc/hosts | grep-v ^ # | grep-v ^ $| while read LINE
Do
For M in `awk'{print $1}'`
Do
If ping-w 1-c 1$ M | grep "100%" > / dev/null
Then
Echo "$M is down"
Else
Echo "$M is up"
Fi
Done
Done
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.