Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-09-2003, 08:45 AM   #1
LQ Newbie
Registered: Sep 2003
Posts: 3

Rep: Reputation: 0
Ping - Logging the times to a file.

I would like to be able to log the round trip times to a file when pinging. Additionally, I would like to be able to modify the frequency of the pinging. Is there a way to do this? If not, then where can I find some compilable source for the ping program, so that I can modify it. I am running a recent version of Red Hat Linux.
Old 09-09-2003, 09:04 AM   #2
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
Well, "man ping" would do some good for you It seems "ping -i <time interval in seconds>" sets the ping time interval... Then, to log the ping output to a file, just redirect it; "ping > outputfile". Or was this too obvious? Sorry if I misunderstood
Old 09-09-2003, 02:09 PM   #3
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
If you want to add the date you could use:
while [ 1 ];do date +"%x %X - `ping -c1|grep rtt`" >> ping.log;sleep 60;done
The example above waits for 60 seconds between pings.

The "ping.log" file would have entries like:
09/09/03 18:33:31 - rtt min/avg/max/mdev = 0.070/0.070/0.070/0.000 ms


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to log traceroute or ping times wkm001 Linux - Software 4 10-22-2011 07:27 AM
Logging times in squid eantoranz Linux - Software 6 06-26-2005 06:16 PM
Ping hangs and Konq times out... Lostboy7500 Linux - Networking 1 10-09-2004 07:41 PM
prioritise packets with cbq.init for better ping times kilgor Linux - Networking 1 05-28-2004 12:20 PM
Logging off and locking out users at specific times Kahless Linux - Software 5 02-19-2004 02:21 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration