Discussion Locked

Need help with ping command........

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

I am actually having some issues with ping command,
I have a scenario where in i am having to run a contineous ping i.e ping google.co -t.
Now what i want is to use ctrl+beak after every hour.
i do not wish to press ctrl+beak manually, it should be done automatically after every hour.

Could some one please help me to create a batch file with this fuctionality.

Please help and revert at your earliest.
Thanks in advance.

MD

11 replies

by ak_gates2010

Hi Tony,
Thanks for the reply, However if i use -n parameter, it may work in some cases like if the site is working properly and may vary from site to site as well. But in case there are a number of RTO's it will take more than an hour to send the same number of echo requests.
So what i want is exatcly after one hour there must acour a CTRL+BREAK action No matter how many packets are sent in that perticular hour.

Please Help with the same.

by tony hopkinson

How long do yu wait for a response, do you care if you get one?
Is there some metric for x responses per hour?

It sounds like you are pinging in response to a success or fail.
Not big on this sort of scripting , but coding wise you need to do something like
store the time

loop while curent time - starttime < 1 hour
ping once
(do something with result ?)
end loop

by dumphrey

while be very difficult. Loops do not work well there, and the midnight time shift could cause problems.

by tony hopkinson

My typical approach to this sort of thing would be to write a program. :p

That I can do.

In Linux I'd probably knock up a perl script, to do anything 'complex', maybe something like Python would be a better approach for this sort of thing.

by ak_gates2010

Ya Tony. it we couyld go that way,,,,,,,,, But i am usin windows and i wanna do all this with batch ptogramming...........
so all dos command are to used..

Please trying to get some thing which i lso can understand

by Member 25348569

is actually what you want to achieve. There might be a better way!

The way I'd probably do it is to have a batch file that constantly fires up ping -t in a loop and have another program running that waits for an hour and then kills the ping process and then goes back to sleep. But why would I?

Neil ?:|

by ak_gates2010

Ya neil...... This is something i want.
Actually i need to have ping response of every hour for perticular site so that i could analyze how many packets were lost in which pertilar hour,

I am directing ping response to one text file , it has every thing i want except one thing. that is every hour i need to press ctrl+break to check the packet loss.
I want this function to automate.

Now i think the whole picture should be clear.

Please help to get it done.

by tony hopkinson

One progrm that simply pings contunually and writes to txt file, you already have.
An other program that's scheduled to run once an hour
That kills the pinger, analyses the output, stores it somewhere else (another txt file ?)
delets / moves the pinger output file
Then starts up the pinger again, is probably the way to go then.

Using the scheduler for the timer and separating collection from analysis / reporting should solve most of your problems.

Get a bit clever with the analysis and how often you run the reporter process is your data length.

so if something goes wrong you can work out how long the process was running for and pro-rata the data into a per hour figure.

by Member 25348569

Save the bit between the dashed lines as killping.vbs. Run it with the Windows Scheduler and it will shut down any running ping processes.

'-------------------------
Set objWMI = CreateObject("wbemScripting.Swbemlocator")
Set objServer = objWMI.ConnectServer

Set colProcesses = objServer.InstancesOf("Win32_Process")
For each objProcess in colProcesses
If objProcess.Name = "ping.exe" Then
objProcess.Terminate
End If
Next
'-------------------------

You can also use TASKKILL.EXE from the command line. It's supplied with XP but I can't stop myself writing scripts.

Neil :D

This discussion is closed to new replies.