LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2006, 08:28 AM   #1
Electric-Gerbil
LQ Newbie
 
Registered: Feb 2005
Posts: 11

Rep: Reputation: 0
Timestamping each line of 'ping' output


Currently, my home internet connection is very unstable - it drops out every few minutes. Understandably very annoying. So I'm trying to use the ping command to find out when the internet connection fails. This method works fine for when I just want to detect that a failure's occurred, but I also want to be able to determine the time at which these failures occurred.

As such, I'm wondering if there's any way I can get the console to show a timestamp for each line of output from the ping command, and ideally if this output can also be written to a file at the same time it appears on the console.

Many thanks in advance for any assistance rendered.

- EG

Last edited by Electric-Gerbil; 12-02-2006 at 08:43 AM.
 
Old 12-02-2006, 09:57 AM   #2
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
You could run a small script via cron, for example:

Code:
#!/bin/bash

ping -c 2 $1 1>/dev/null

if [ "$?" = 1 ]
then
    echo "`date` : Network down" >> /path-to/ping-log
fi

Last edited by fordeck; 12-02-2006 at 10:23 AM.
 
  


Reply



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
can ping network computer, cannot ping google.com (help needed) ben_build#2.1.0 Linux - Wireless Networking 23 11-07-2010 12:55 PM
ping failures resolve external public dns/ip address dkeller626 Linux - Networking 2 06-29-2006 09:20 PM
Network icon to detect wireless network is gone Micro420 SUSE / openSUSE 1 01-28-2006 02:14 PM
Can ping network but can't ping any internet ip when I hard set the ip Streme Linux - Wireless Networking 4 04-13-2004 09:18 AM
Ping - How to detect SaTaN Programming 9 01-04-2004 01:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:21 PM.

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