Solved

DOS script which will ping once every 60 seconds

Posted on 2009-07-14
12
950 Views
Last Modified: 2012-05-07
Hi,

I would need help to create one ping at the time for every 60 seconds.

Thanks.

REgards,

rAdny
0
Comment
Question by:randybanaria
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 7

Expert Comment

by:namol
ID: 24849134
Create a batch file with ping -n 1 targethere in it and then add it to the scheduler per the instructions on this page.
http://www.videohelp.com/forum/archive/need-to-run-a-vbsscript-every-60-seconds-t247224.html
0
 
LVL 5

Expert Comment

by:Dhope
ID: 24849212
Following should do it (save as a batch file)

:startagain
PING -n 1 machineName >>ping.log
TYPE NUL | CHOICE.COM /N /CY /TY,60 >NUL
goto startagain
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 24849645
Or the traditional way:

:loop
ping -n 1 machine
ping -n 61 127.0.0.1 >nul 2>nul
goto loop

0
 

Author Comment

by:randybanaria
ID: 24850132
I will try them.

let you know what's the result..

Thanks.
0
 

Author Comment

by:randybanaria
ID: 24850612
i should close this ticket becoz it's a redundant ticket.
0
 
LVL 8

Expert Comment

by:JT92677
ID: 24860413
This avoids pinging localhost over and over again

:loop
ping -n 1 -w 500 mit.edu
ping -n 1 -w 6000 noplace.tv
goto loop

ping the target 1 time, wait at most 5 seconds for a response
ping a non-existent site 1 time, waiting for 60 seconds (it won't respond)
loop back to beginning

Doesn't keep pinging localhost or using a file for junk output
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 68

Expert Comment

by:Qlemo
ID: 24861421
Pinging localhost is less bad then pinging into internet, or creating unnecessary DNS traffic. If using the "wait timeout" method, you should use a fixed, non-routed address which is not existing. That's causing ARP traffic only.
0
 
LVL 8

Accepted Solution

by:
JT92677 earned 500 total points
ID: 24862085
One ping in 60 seconds is hardly a DNS traffic issue given the enormous number of packets required to render a single webpage.

but if that is a great concern, he could issue a ping to an IP address in the network that does not resolve to any hardware.

This next set of commands pings my FTP server every 60 seconds using a non-existent IP for the 60 second wait interval

:loop
ping -n 1 -w 500 172.16.42.21
ping -n 1 -w 6000 172.16.42.254
goto loop

I can't get too excited about a ping every minute on the public nework, given the enormous volume of traffic required to render a single webpage.

0
 
LVL 68

Expert Comment

by:Qlemo
ID: 24863450
If it is for any use - ok. But totally senseless traffic should be avoided. And the "one ping per second to localhost" is no burden to the CPU or anything. Why not use it?
0
 
LVL 8

Expert Comment

by:JT92677
ID: 24864295
Apparently it is for a use although the direct benefit isn't obvious, the indirect benefit is that it solves the problem with virtually no impact on the network, regardless of how senseless it appears.

But in deference to your observation, I suggested an alternative to ping a local unused IP address on the local network. Or is that a problem too?

The objective is to solve the problem. Check out "suboptimal" and "suboptimization"

http://en.wiktionary.org/wiki/suboptimal
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 24867398
"This avoids pinging localhost over and over again"
This implies that there are cons. There are none.

If you just wrote: "If you don't like pinging localhost every second ...", this would have been an alternative. Your proposal creates the imagination that it is better than all others. It is not.
I myself often present both solutions as coequal alternative ways. Choosing one of them is no matter of logic, but of preference.

In  reference to your reference: I don't know what you want to say with it. Didn't you see the last message  of original poster: "i should close this ticket becoz it's a redundant ticket."? This tells you it is not even suboptimal to further post here.
0
 
LVL 8

Expert Comment

by:JT92677
ID: 24871033
QLEMO: Since you seem to want to argue about my posts, let me address your concerns:

Pinging over and over again relies on the idea that each ping response takes a known amount of time, and that there won't be any accumulated error using multiple pings with unpredictable timing. This is simply wrong.

I would submit that a single ping with a 60 second timeout, to a non-existent IP address will run a single timer and produce a more accurate result, and that it is simpler to understand as well.

As is the case in many solutions, the simplest solution is often the best one, as anyone who understands the idea behind Occam's razor. I think my solution is simple and easy to understand, and it produces the expected results.

The author has not closed the ticket, perhaps this is why he used the term "should" instead of "will." Apparently the ticket is still open, or the author has lost interest. My crystal ball is not providing a clear answer to this question, maybe you know what's in the authors mind, I don't.

Your use of "not even suboptimal to further post here" -- is a bit confusing, and seems to indicate a misunderstanding of what is meant by suboptimal.

As to creating the imagination that a solution is better than another, I'll stick with the idea that simpler is better.

Since you have so many points (and have been an EE contributor for many years) you might simply clean up this question on your own. I am a new EE member, but that doesn't mean I'm new to solving computer problems. As a result, I don't have nearly as many points as you do, but you have a 5 year or more head start <<grin>>

As I see EE, we're here to provide suggestions, and alternatives. Points are a byproduct, not the purpose of a comment or solution.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now