Windows Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsWindows Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 4th, 2012, 01:14 PM
NewAdminGuy NewAdminGuy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 3 NewAdminGuy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 48 sec
Reputation Power: 0
Help with a ping batch file please

Hi,

I have this problem at work.

It looks like the connection to one of our servers is dropping out randomly.

I want to write a batch file to constantly ping the server address and output the results to a text file that includes a date stamp. I also need to see the cmd prompt open and looking like its working for my peace of mind.

I am on Windows Server 2000 and have tried the following:

:TOP

echo %time% >> C:\PingServer.txt

ping serveraddress >> C:\PingServer.txt

GOTO TOP

I have tried testing this on my laptop at home but nothing happens. Im running Windows 7 at home.

Thanks in advance

Reply With Quote
  #2  
Old April 4th, 2012, 02:19 PM
AdamPI's Avatar
AdamPI AdamPI is offline
Automagically Delicious
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: May 2004
Location: 127.0.0.2 - I live next door.
Posts: 2,199 AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 22 h 26 m 16 sec
Reputation Power: 2736
Code:
ping -t 192.168.1.1 << C:\pingout.txt
This might not display to the screen but your text file will continue to fill. You can run the above without running it as a script.
__________________
Adam TT

Reply With Quote
  #3  
Old April 4th, 2012, 02:55 PM
NewAdminGuy NewAdminGuy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 3 NewAdminGuy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 48 sec
Reputation Power: 0
Quote:
Originally Posted by AdamPI
Code:
ping -t 192.168.1.1 << C:\pingout.txt
This might not display to the screen but your text file will continue to fill. You can run the above without running it as a script.


The file don't write on my machine. How do you write this in dos?

Thanks

Reply With Quote
  #4  
Old April 4th, 2012, 06:31 PM
aitken325i's Avatar
aitken325i aitken325i is offline
Providing fuel for space ships
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Mar 2004
Location: nr Edinburgh, Scotland
Posts: 14,360 aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)aitken325i User rank is General 42nd Grade (Above 100000 Reputation Level)  Folding Points: 10110 Folding Title: Novice Folder
Time spent in forums: 6 Months 1 Day 13 h 7 m 3 sec
Reputation Power: 3777
This is in DOS, only the chevrons are the wrong way around:
Code:
ping -t 192.168.1.1 >> C:\pingout.txt
__________________
The No Ma'am commandments:

1.) It is O.K. to call hooters 'knockers' and sometimes snack trays
2.) It is wrong to be French
3.) It is O.K. to put all bad people in a giant meat grinder
4.) Lawyers, see rule 3
5.) It is O.K. to drive a gas guzzler if it helps you get babes
6.) Everyone should car pool but me
7.) Bring back the word 'stewardesses'
8.) Synchronized swimming is not a sport
9.) Mud wrestling is a sport

Reply With Quote
  #5  
Old April 5th, 2012, 02:06 AM
NewAdminGuy NewAdminGuy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 3 NewAdminGuy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 48 sec
Reputation Power: 0
Thanks for that. Sorry I missed it before as I was looking on my phone. Could you please tell me how to add a time stamp to each sent ping?

Reply With Quote
  #6  
Old April 5th, 2012, 12:07 PM
AdamPI's Avatar
AdamPI AdamPI is offline
Automagically Delicious
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: May 2004
Location: 127.0.0.2 - I live next door.
Posts: 2,199 AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level)AdamPI User rank is General 26th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 22 h 26 m 16 sec
Reputation Power: 2736
In that case you will need a script (Sorry about the backwards brackets.)

I'd suggest using Powershell, your script could look something like this:
Code:
$logs = "C:\pingDS.txt"
$wait = 10

while("true"){
    Get-Date | out-file "$logs" -append
    ping 127.0.0.1 | out-file "$logs" -append
    
    "Waiting $wait seconds"
    start-sleep -s $wait
}
wrote it quick and dirty, so it may need some polishing

Reply With Quote
  #7  
Old April 5th, 2012, 04:03 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,257 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 18 h 51 m 19 sec
Reputation Power: 4445
Just FYI there are a bunch of available server monitoring applications both free and non-free. One of these apps may be better for you. Most include email notifications and such.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsWindows Help > Help with a ping batch file please

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap