Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DOS script which will ping once every 60 seconds

Posted on 2009-07-14
12
Medium Priority
?
967 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 71

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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

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
 
LVL 71

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 1500 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 71

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 71

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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

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…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

688 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