Old school batch file for logging broadband connectivity

Recently the BT Broadband ADSL line at our shared office has been having problems.  Slow speeds but more importantly regularly dropping out.  We moved over to a second broadband connection but wanted to monitor the state of the original broadband connection so we could confirm the fault had been fixed.

Should I code it in C#, thrash out some PowerShell scripts, pah!  No, an old fashioned .cmd file and some batch commands will do ..... need to know the time, try a ping, and then wait for 10 seconds before repeating it.

So here's the batch file I wrote (pingWait.cmd);

  :loopStart

  time < cr.txt
  ping www.bbc.co.uk
  timeout /t 10

  goto loopStart

It required a single extra file with a LF/CR in it, cr.txt, which pipes an 'Enter' key to 'set' the time (otherwise time would hang) and you run it like this, piping the output to the specified log file;

  pingwait > log-2008-09-09.txt

Job done.  When a BT OpenReach field engineer popped round I could load up the file and we could locate all the times the broadband had gone off line and when it had recovered.  It even included the DNS lookup working but the ping failing as the connection was initialising.

Ah, it took me back to my time helping manage the complex set of batch file scripts and DOS menu utilities which handled the network logon to Netware 3.11 servers for GMTV.

Note: piping the output does mean the text file is locked, you have to break out of the batch file to view it.  A minor niggle.
Print | posted on Tuesday, September 09, 2008 9:43 AM

Feedback

# re: Old school batch file for logging broadband connectivity

left by bobfox at 9/14/2008 6:45 PM Gravatar
You don't need the extra file cr.txt.

echo.|time

will do it.

It's also possible to view the log file without breaking out of the batch file with:

type logfilename.txt

Or you can use a text editor which can handle this like UltraEdit http://www.ultraedit.com

regards, Robert

# re: Old school batch file for logging broadband connectivity

left by Liam Westley at 9/15/2008 10:32 AM Gravatar
Robert,

Top tips, my batch file skills are horribly rusty and that's a great improvement.

Liam

# re: Old school batch file for logging broadband connectivity

left by FunThomas at 9/22/2008 12:14 PM Gravatar
Instead of using cr.txt, you can use either
TIME /T (prints HH:MM)
or
echo %time% (prints HH:MM:SS:hh)
Title  
Name
Email (never displayed)
Url
Comments   
Please add 6 and 8 and type the answer here: