Ping Command
Is there a way for the ping command under Linux to behave like the Windows version when there are dropped packets...i.e. echo "request timed out" or something similar. Below is a script I have pieced together from various sources (as I am not a script master) to ping a given ip address and print a time stamp every 20 lines. My goal is to have it also echo the dropped packets to the log so that I can show packet loss in a time-frame reference. I have read the man page and tried every possible combination and it looks like it's going to come down to a bit of code. ping -i 6 -c $count $ip | { n=0
---------------------/
Will wait 2 seconds after pinging, at which time it will
exit, displaying summary info for the ping, including % dropped packets.
Is supposed to stop pinging that host after 2 seconds, but for some reason it doesn't work for me... ---------------------/
reply from ........
etc, etc. ---------------------/
---------------------/
--- www.google.akadns.net ping statistics ---
if a packet is dropped you will NOT see the echo on the screen in real time...you'll only know it when the ping is stopped and you get the summary of sent, received, lost, etc. I'm looking for a way to FORCE the ping command under Linux to behave like the ping command under Windows. Windows ping returns: N:\>ping www.google.com Pinging www.google.akadns.net [64.233.161.104] with 32 bytes of data: Reply from 64.233.161.104: bytes=32 time=10ms TTL=243
Ping statistics for 64.233.161.104:
the "-w" just tells ping to give up after a deadline isn't met. I want the test to run non-stop regardless of the result. If packets are answered...great. If not, I need to see the dropped packets with time stamps (as the original script posted shows). The time stamp issue has been solved. I now need to see the packet loss in real time. I frequently need to test internet connections for packet loss. Sometimes this packet loss only occurs at certain times of day. ---------------------/
---------------------/
---------------------/
Have a Linux Problem
Linux Books
Linux Home: Linux System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|