首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >网络监控ping

网络监控ping
EN

Stack Overflow用户
提问于 2014-07-17 07:30:27
回答 1查看 80关注 0票数 1

我正在从一个txt文件中读取几百个ip地址,想把这个列表ping到文件的末尾。我想让它在循环中运行,读到文件的末尾,然后再次从第一个地址开始。

代码语言:javascript
复制
trap 'echo ****Interrupted****; exit'INT

echo -n "Enter the file name with the ip addresses"
read file

echo -n "Enter the file name for the log file"
read log

while read line
do
echo "pinging: "$line
echo -e "">>$log
echo -n "NEXT PING: ">>$log
echo -n "$line" : " >>$log
$ping -c 3 -W 2 $line >>$log
done <"$file"
EN

回答 1

Stack Overflow用户

发布于 2014-08-22 02:44:45

使用fping

http://fping.org/

fping手册页:

代码语言:javascript
复制
DESCRIPTION
   fping  is  a  program  like ping(8) which uses the Internet Control Message 
   Protocol (ICMP) echo request to determine if a target host is responding.
   fping differs from ping in that you can specify any number of targets on the 
   command line, or specify a file containing the lists of targets to ping.
   Instead  of  sending  to  one target until it times out or replies, fping will
   send out a ping packet and move on to the next target in a round-robin
   fashion. 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24792544

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档